INNER CODE UNIT · Python
__init__
evalstate/fast-agent · src/fast_agent/a2a/server.py:161
def __init__(self, app: ASGIApp, *, provider: str) -> None:
self.app = app
self.provider = provider
self.token_verifier = HuggingFaceOAuthOrHubTokenVerifier()
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
if scope["type"] != "http":
await self.app(scope, receive, send)
return
path = str(scope.get("path", ""))
if not path.startswith("/a2a/"):
await self.app(scope, receive, send)
return
headers = list(scope.get("headers", []))
authorization = _header_value(headers, b"authorization")
hf_authorization = _header_value(headers, b"x-hf-authorization")