Skip to content

Commit 98b2e11

Browse files
committed
Updated documentation for a2a endpoints
1 parent 6c7b589 commit 98b2e11

1 file changed

Lines changed: 61 additions & 36 deletions

File tree

src/app/endpoints/a2a.py

Lines changed: 61 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,17 @@ async def get_agent_card( # pylint: disable=unused-argument
685685
This endpoint provides the agent card that describes Lightspeed's
686686
capabilities according to the A2A protocol specification.
687687
688-
Returns:
689-
AgentCard: The agent card describing this agent's capabilities.
688+
### Parameters:
689+
- auth: Authentication tuple from the auth dependency (used by middleware).
690+
691+
### Raises:
692+
- HTTPException: with status 500 and a detail object containing `response`
693+
and `cause` when service configuration is wrong or incomplete.
694+
- HTTPException: with status 503 and a detail object containing `response`
695+
and `cause` when unable to connect to Llama Stack.
696+
697+
### Returns:
698+
- AgentCard: The agent card describing this agent's capabilities.
690699
"""
691700
try:
692701
logger.info("Serving A2A Agent Card")
@@ -757,23 +766,29 @@ async def handle_a2a_jsonrpc_get(
757766
Thin wrapper that delegates to ``_handle_a2a_jsonrpc`` so GET and POST share
758767
the same processing path while keeping distinct OpenAPI operation metadata.
759768
760-
Args:
761-
request: Incoming ASGI/FastAPI request (body, scope, headers).
762-
auth: Resolved authentication tuple from ``auth_dependency`` (user
763-
identity and bearer token used to build the per-request A2A app).
764-
mcp_headers: MCP-related headers from ``mcp_headers_dependency``, forwarded
765-
into the A2A executor for downstream tool/context propagation.
769+
### Parameters:
770+
- request: Incoming ASGI/FastAPI request (body, scope, headers).
771+
- auth: Resolved authentication tuple from ``auth_dependency`` (user
772+
identity and bearer token used to build the per-request A2A app).
773+
- mcp_headers: MCP-related headers from ``mcp_headers_dependency``, forwarded
774+
into the A2A executor for downstream tool/context propagation.
775+
776+
### Raises:
777+
- HTTPException: with status 401 for unauthorized access.
778+
- HTTPException: with status 403 if permission is denied.
779+
- HTTPException: with status 500 and a detail object containing `response`
780+
and `cause` when service configuration is wrong or incomplete.
781+
- HTTPException: with status 503 and a detail object containing `response`
782+
and `cause` when unable to connect to Llama Stack.
783+
784+
### Returns:
785+
- ``Response`` with the full buffered JSON-RPC (or HTTP)
786+
payload when the request is non-streaming, or
787+
``StreamingResponse`` (SSE) when the JSON-RPC method is
788+
``message/stream`` and chunks are streamed to the client.
789+
Error conditions are generally expressed as JSON-RPC or HTTP
790+
responses rather than by raising from this wrapper.
766791
767-
Returns:
768-
``Response`` with the full buffered JSON-RPC (or HTTP) payload when the
769-
request is non-streaming, or ``StreamingResponse`` (SSE) when the
770-
JSON-RPC method is ``message/stream`` and chunks are streamed to the
771-
client. Error conditions are generally expressed as JSON-RPC or HTTP
772-
responses rather than by raising from this wrapper.
773-
774-
Raises:
775-
HTTPException: If authentication or ``@authorize`` rejects the request
776-
before or while entering the handler chain.
777792
"""
778793
return await _handle_a2a_jsonrpc(request, auth, mcp_headers)
779794

@@ -799,23 +814,27 @@ async def handle_a2a_jsonrpc_post(
799814
Thin wrapper that delegates to ``_handle_a2a_jsonrpc`` so GET and POST share
800815
the same processing path while keeping distinct OpenAPI operation metadata.
801816
802-
Args:
803-
request: Incoming ASGI/FastAPI request (body, scope, headers).
804-
auth: Resolved authentication tuple from ``auth_dependency`` (user
805-
identity and bearer token used to build the per-request A2A app).
806-
mcp_headers: MCP-related headers from ``mcp_headers_dependency``, forwarded
807-
into the A2A executor for downstream tool/context propagation.
817+
### Parameters:
818+
- request: Incoming ASGI/FastAPI request (body, scope, headers).
819+
- auth: Resolved authentication tuple from ``auth_dependency`` (user
820+
identity and bearer token used to build the per-request A2A app).
821+
- mcp_headers: MCP-related headers from ``mcp_headers_dependency``, forwarded
822+
into the A2A executor for downstream tool/context propagation.
823+
824+
### Raises:
825+
- HTTPException: with status 401 for unauthorized access.
826+
- HTTPException: with status 403 if permission is denied.
827+
- HTTPException: with status 503 and a detail object containing `response`
828+
and `cause` when unable to connect to Llama Stack.
829+
830+
### Returns:
831+
- ``Response`` with the full buffered JSON-RPC (or HTTP)
832+
payload when the request is non-streaming, or
833+
``StreamingResponse`` (SSE) when the JSON-RPC method is
834+
``message/stream`` and chunks are streamed to the client.
835+
Error conditions are generally expressed as JSON-RPC or HTTP
836+
responses rather than by raising from this wrapper.
808837
809-
Returns:
810-
``Response`` with the full buffered JSON-RPC (or HTTP) payload when the
811-
request is non-streaming, or ``StreamingResponse`` (SSE) when the
812-
JSON-RPC method is ``message/stream`` and chunks are streamed to the
813-
client. Error conditions are generally expressed as JSON-RPC or HTTP
814-
responses rather than by raising from this wrapper.
815-
816-
Raises:
817-
HTTPException: If authentication or ``@authorize`` rejects the request
818-
before or while entering the handler chain.
819838
"""
820839
return await _handle_a2a_jsonrpc(request, auth, mcp_headers)
821840

@@ -1008,8 +1027,14 @@ async def a2a_health_check() -> dict[str, str]:
10081027
"""
10091028
Health check endpoint for A2A service.
10101029
1011-
Returns:
1012-
Dict with health status information.
1030+
### Parameters:
1031+
- None
1032+
1033+
### Raises:
1034+
- None
1035+
1036+
### Returns:
1037+
- Dict with health status information.
10131038
"""
10141039
return {
10151040
"status": "healthy",

0 commit comments

Comments
 (0)