Skip to content
Open
Changes from all commits
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
17 changes: 13 additions & 4 deletions src/strands/multiagent/a2a/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,20 @@ def agent_skills(self, skills: list[AgentSkill]) -> None:
"""
self._agent_skills = skills

def to_starlette_app(self) -> Starlette:
def to_starlette_app(self, **kwargs: Any) -> Starlette:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case there's something else we eventually want to pass here, we think it makes more sense to pass this in explicitly as a dictionary that is passed into each app. For instance, something like:

def to_starlette_app(self, *, app_args: dict[str, Any] | None = None):
    ...
    A2AStarletteApplication(...).build(**app_args)
    ...

Naming wise, app_kargs or app_config build_input might make sense, depending on the naming of what build takes.

Copy link
Author

@snooyen snooyen Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build methods for A2AFastAPIApplication and A2AStarletteApplication expose **kwargs: Any which is how I arrived at the changes I initially proposed.

Since an explicit dict is requested, I would say app_kwargs sounds okay.

"""Create a Starlette application for serving this agent via HTTP.

Automatically handles path-based mounting if a mount path was derived
from the http_url parameter.

**kwargs: Additional keyword arguments to pass to the Starlette constructor.

Returns:
Starlette: A Starlette application configured to serve this agent.
"""
a2a_app = A2AStarletteApplication(agent_card=self.public_agent_card, http_handler=self.request_handler).build()
a2a_app = A2AStarletteApplication(agent_card=self.public_agent_card, http_handler=self.request_handler).build(
**kwargs
)

if self.mount_path:
# Create parent app and mount the A2A app at the specified path
Expand All @@ -196,16 +200,21 @@ def to_starlette_app(self) -> Starlette:

return a2a_app

def to_fastapi_app(self) -> FastAPI:
def to_fastapi_app(self, **kwargs: Any) -> FastAPI:
"""Create a FastAPI application for serving this agent via HTTP.

Automatically handles path-based mounting if a mount path was derived
from the http_url parameter.

Args:
**kwargs: Additional keyword arguments to pass to the FastAPI constructor.

Returns:
FastAPI: A FastAPI application configured to serve this agent.
"""
a2a_app = A2AFastAPIApplication(agent_card=self.public_agent_card, http_handler=self.request_handler).build()
a2a_app = A2AFastAPIApplication(agent_card=self.public_agent_card, http_handler=self.request_handler).build(
**kwargs
)

if self.mount_path:
# Create parent app and mount the A2A app at the specified path
Expand Down