-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
25 lines (20 loc) · 839 Bytes
/
main.py
File metadata and controls
25 lines (20 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""
This file initializes a FastAPI application for the Sample BigQuery ADK Agent
with A2A (Agent-to-Agent) protocol support. This makes the agent deployable to
Cloud Run and accessible via Agentspace.
"""
import os
import uvicorn
from dotenv import load_dotenv
from google.adk.a2a.utils.agent_to_a2a import to_a2a
load_dotenv()
from bigquery_agent.agent import root_agent
# Create A2A-compatible FastAPI app
# This will:
# - Expose the agent via A2A protocol (handles POST requests)
# - Auto-generate agent card at /.well-known/agent-card.json
# - Enable Agentspace integration
app = to_a2a(root_agent, port=int(os.environ.get("PORT", 8080)))
if __name__ == "__main__":
# Use the PORT environment variable for Cloud Run compatibility, default to 8080.
uvicorn.run(app, host="0.0.0.0", port=int(os.environ.get("PORT", 8080)))