Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into ae_routes
  • Loading branch information
rajeshvelicheti authored Aug 11, 2025
commit b2bb57fb9eab913020f70c64e1516bd9f4ceabdc
20 changes: 19 additions & 1 deletion src/a2a/server/apps/rest/fastapi_app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
import logging

from collections.abc import Callable
from typing import Any
from typing import TYPE_CHECKING, Any


if TYPE_CHECKING:
from fastapi import APIRouter, FastAPI, Request, Response

_package_fastapi_installed = True
else:
try:
from fastapi import APIRouter, FastAPI, Request, Response

_package_fastapi_installed = True
except ImportError:
APIRouter = Any
FastAPI = Any
Request = Any
Response = Any

_package_fastapi_installed = False


from a2a.server.apps.jsonrpc.jsonrpc_app import CallContextBuilder
Expand All @@ -23,35 +41,35 @@
(SSE).
"""

def __init__( # noqa: PLR0913
self,
agent_card: AgentCard,
http_handler: RequestHandler,
extended_agent_card: AgentCard | None = None,
context_builder: CallContextBuilder | None = None,
card_modifier: Callable[[AgentCard], AgentCard] | None = None,
extended_card_modifier: Callable[
[AgentCard, ServerCallContext], AgentCard
]
| None = None,
):
"""Initializes the A2ARESTFastAPIApplication.

Args:
agent_card: The AgentCard describing the agent's capabilities.
http_handler: The handler instance responsible for processing A2A
requests via http.
extended_agent_card: An optional, distinct AgentCard to be served
at the authenticated extended card endpoint.
context_builder: The CallContextBuilder used to construct the
ServerCallContext passed to the http_handler. If None, no
ServerCallContext is passed.
card_modifier: An optional callback to dynamically modify the public
agent card before it is served.
extended_card_modifier: An optional callback to dynamically modify
the extended agent card before it is served. It receives the
call context.
"""

Check notice on line 72 in src/a2a/server/apps/rest/fastapi_app.py

View workflow job for this annotation

GitHub Actions / Lint Code Base

Copy/pasted code

see src/a2a/server/apps/rest/rest_adapter.py (55-83)
if not _package_fastapi_installed:
raise ImportError(
'The `fastapi` package is required to use the'
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.