diff --git a/src/strands/multiagent/a2a/server.py b/src/strands/multiagent/a2a/server.py index bbfbc824d..3e2951f14 100644 --- a/src/strands/multiagent/a2a/server.py +++ b/src/strands/multiagent/a2a/server.py @@ -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: """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 @@ -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