INNER CODE UNIT · Python
build
evalstate/fast-agent · src/fast_agent/a2a/server.py:216
def build(self, request: Request) -> Any:
context = super().build(request)
token = getattr(request.state, "fast_agent_bearer_token", None)
if isinstance(token, str) and token:
context.state["fast_agent_bearer_token"] = token
return context
class FastAgentA2AExecutor(AgentExecutor):
"""A2A executor that routes tasks into fast-agent agents."""
def __init__(
self,
primary_instance: AgentInstance,
create_instance: Callable[[], Awaitable[AgentInstance]],
dispose_instance: Callable[[AgentInstance], Awaitable[None]],
*,
primary_agent_name: str,