← back to A2a Lab
smoke_test.py
26 lines
"""A2A Python SDK install smoke test (a2a-sdk 1.1.2, current API).
Run: . .venv/bin/activate && python smoke_test.py
Exits 0 if the client + server + types stacks all import.
"""
from importlib.metadata import version
def main() -> int:
# types
# client (1.x API — ClientFactory / create_client, NOT the old A2AClient)
from a2a.client import A2ACardResolver, ClientFactory, create_client # noqa: F401
from a2a.server.agent_execution import AgentExecutor, RequestContext # noqa: F401
# server (routes mount onto FastAPI/Starlette)
from a2a.server.request_handlers import DefaultRequestHandler # noqa: F401
from a2a.server.routes import add_a2a_routes_to_fastapi # noqa: F401
from a2a.types import AgentCapabilities, AgentCard # noqa: F401
print(f"a2a-sdk {version('a2a-sdk')} — client + server + types import OK")
return 0
if __name__ == "__main__":
raise SystemExit(main())