|
44 | 44 | from configuration import configuration |
45 | 45 | from models.config import Action |
46 | 46 | from models.requests import QueryRequest |
47 | | -from utils.mcp_headers import mcp_headers_dependency |
| 47 | +from utils.mcp_headers import mcp_headers_dependency, McpHeaders |
48 | 48 | from utils.responses import ( |
49 | 49 | extract_text_from_response_output_item, |
50 | 50 | prepare_responses_params, |
@@ -183,17 +183,15 @@ class A2AAgentExecutor(AgentExecutor): |
183 | 183 | routing queries to the LLM backend using the Responses API. |
184 | 184 | """ |
185 | 185 |
|
186 | | - def __init__( |
187 | | - self, auth_token: str, mcp_headers: Optional[dict[str, dict[str, str]]] = None |
188 | | - ): |
| 186 | + def __init__(self, auth_token: str, mcp_headers: Optional[McpHeaders] = None): |
189 | 187 | """Initialize the A2A agent executor. |
190 | 188 |
|
191 | 189 | Args: |
192 | 190 | auth_token: Authentication token for the request |
193 | 191 | mcp_headers: MCP headers for context propagation |
194 | 192 | """ |
195 | 193 | self.auth_token: str = auth_token |
196 | | - self.mcp_headers: dict[str, dict[str, str]] = mcp_headers or {} |
| 194 | + self.mcp_headers: McpHeaders = mcp_headers or {} |
197 | 195 |
|
198 | 196 | async def execute( |
199 | 197 | self, |
@@ -648,9 +646,7 @@ async def get_agent_card( # pylint: disable=unused-argument |
648 | 646 | raise |
649 | 647 |
|
650 | 648 |
|
651 | | -async def _create_a2a_app( |
652 | | - auth_token: str, mcp_headers: dict[str, dict[str, str]] |
653 | | -) -> Any: |
| 649 | +async def _create_a2a_app(auth_token: str, mcp_headers: McpHeaders) -> Any: |
654 | 650 | """Create an A2A Starlette application instance with auth context. |
655 | 651 |
|
656 | 652 | Args: |
@@ -681,7 +677,7 @@ async def _create_a2a_app( |
681 | 677 | async def handle_a2a_jsonrpc( # pylint: disable=too-many-locals,too-many-statements |
682 | 678 | request: Request, |
683 | 679 | auth: Annotated[AuthTuple, Depends(auth_dependency)], |
684 | | - mcp_headers: dict[str, dict[str, str]] = Depends(mcp_headers_dependency), |
| 680 | + mcp_headers: McpHeaders = Depends(mcp_headers_dependency), |
685 | 681 | ) -> Response | StreamingResponse: |
686 | 682 | """ |
687 | 683 | Handle A2A JSON-RPC requests following the A2A protocol specification. |
|
0 commit comments