flowchart LR
subgraph API
A[POST /api/chat]
end
subgraph GeneralController
B[chat]
C[_stream_events]
D[_save_conversation]
end
subgraph GeneralAgent
E[InMemorySessionService]
F[getConversationsListTool<br/>MCP tools]
G[LlmAgent orchestrator]
H[MentalHealth LlmAgent]
I[Orthopedic LlmAgent]
end
subgraph Runner
J[run_async]
end
subgraph External
K[MCP server]
L[Conversation API<br/>save / summaries / semantic-search]
end
A --> B
B --> E
B --> G
G --> F
G --> H
G --> I
B --> J
J --> G
F --> K
C --> J
C --> D
D --> L
├── main.py # Entry point
├── settings.py # Configuration (reads from .env)
├── requirements.txt # Python dependencies
├── app/
│ ├── server.py # FastAPI app setup & route registration
│ ├── routes/ # API endpoints
│ │ ├── route.py
│ ├── agents/ # AI agent implementations
│ │ └── rule_review_agent/
│ │ ├── agent.py # Core agent logic
│ │ ├── runner.py # Execution wrapper
│ │ ├── executor.py # A2A protocol handler
│ │ ├── request_handler.py # A2A app setup
│ │ ├── agent_card.py # A2A agent metadata
│ │ └── knowledge/
│ │ └── prompts.py # System prompts
│ ├── services/ # Business logic services
│ ├── controllers/ # Controller layer
│ ├── config/ # DB connections, configs
│ ├── middleware/ # Auth, response wrappers
│ ├── models/ # Data models
│ └── utils/ # Utilities
└── tests/ # Test files
To see and test the general orchestrator agent in the ADK web interface:
- Install the ADK CLI (if not already):
pip install google-adk - From the project root (this directory), run:
If port 8000 is in use, use another port, e.g.
adk web --port 8000
adk web --port 8001. - Open http://127.0.0.1:8000 in your browser.
- In the web UI, select the general_orchestrator agent from the dropdown (top left), then chat.
The agent is discovered from the general_orchestrator/ folder, which exposes root_agent for the ADK CLI. Your main app (FastAPI on port 7777) is unchanged and can still be used for production or custom frontends.
pip install -r requirements.txtCreate a .env file with your API keys:
GOOGLE_API_KEY=your_google_api_key
OPENAI_API_KEY=your_openai_api_key
ANTHROPIC_API_KEY=your_anthropic_api_keypython main.pyOr with uvicorn directly:
uvicorn app.server:app --reload- API Docs: http://localhost:8000/docs
- Health Check: http://localhost:8000/health
To create a new agent, follow this structure:
app/agents/my_new_agent/
├── __init__.py
├── agent.py # Core agent logic
├── runner.py # Execution wrapper
├── executor.py # A2A executor (if A2A enabled)
├── request_handler.py # A2A app setup (if A2A enabled)
├── agent_card.py # A2A metadata (if A2A enabled)
└── knowledge/
├── __init__.py
└── prompts.py # System prompts
- agent.py: Contains the core agent logic, LLM integration, and response processing
- runner.py: Wraps the agent with timeout handling, error handling, and batch processing
- executor.py: Handles A2A protocol messages and formats responses
- request_handler.py: Sets up FastAPI endpoints for A2A communication
- agent_card.py: Defines agent metadata for A2A discovery
- knowledge/prompts.py: System prompts and templates
pytest tests/ -vWith coverage:
pytest tests/ --cov=app --cov-report=html| Variable | Description | Default |
|---|---|---|
HOST |
Server host | 0.0.0.0 |
PORT |
Server port | 8000 |
DEBUG |
Debug mode | True |
DEFAULT_MODEL |
Default LLM model | gemini-2.0-flash |
MAX_AGENT_ITERATIONS |
Max agent iterations | 10 |
AGENT_TIMEOUT |
Agent timeout (seconds) | 300 |
A2A_ENABLED |
Enable A2A protocol | True |
MIT
/
├── main.py # Entry point
├── settings.py # Configuration (reads from .env)
├── requirements.txt # Python dependencies
├── app/
│ ├── server.py # FastAPI app setup & route registration
│ ├── routes/ # API endpoints
│ │ ├── route.py
│ ├── agents/ # AI agent implementations
│ │ └── rule_review_agent/
│ │ ├── agent.py # Core agent logic
│ │ ├── runner.py # Execution wrapper
│ │ ├── executor.py # A2A protocol handler
│ │ ├── request_handler.py # A2A app setup
│ │ ├── agent_card.py # A2A agent metadata
│ │ └── knowledge/
│ │ └── prompts.py # System prompts
│ ├── services/ # Business logic services
│ ├── controllers/ # Controller layer
│ ├── config/ # DB connections, configs
│ ├── middleware/ # Auth, response wrappers
│ ├── models/ # Data models
│ └── utils/ # Utilities
└── tests/ # Test files
pip install -r requirements.txtCreate a .env file with your API keys:
GOOGLE_API_KEY=your_google_api_key
OPENAI_API_KEY=your_openai_api_key
ANTHROPIC_API_KEY=your_anthropic_api_keypython main.pyOr with uvicorn directly:
uvicorn app.server:app --reload- API Docs: http://localhost:8000/docs
- Health Check: http://localhost:8000/health
To create a new agent, follow this structure:
app/agents/my_new_agent/
├── __init__.py
├── agent.py # Core agent logic
├── runner.py # Execution wrapper
├── executor.py # A2A executor (if A2A enabled)
├── request_handler.py # A2A app setup (if A2A enabled)
├── agent_card.py # A2A metadata (if A2A enabled)
└── knowledge/
├── __init__.py
└── prompts.py # System prompts
- agent.py: Contains the core agent logic, LLM integration, and response processing
- runner.py: Wraps the agent with timeout handling, error handling, and batch processing
- executor.py: Handles A2A protocol messages and formats responses
- request_handler.py: Sets up FastAPI endpoints for A2A communication
- agent_card.py: Defines agent metadata for A2A discovery
- knowledge/prompts.py: System prompts and templates
pytest tests/ -vWith coverage:
pytest tests/ --cov=app --cov-report=html| Variable | Description | Default |
|---|---|---|
HOST |
Server host | 0.0.0.0 |
PORT |
Server port | 8000 |
DEBUG |
Debug mode | True |
DEFAULT_MODEL |
Default LLM model | gemini-2.0-flash |
MAX_AGENT_ITERATIONS |
Max agent iterations | 10 |
AGENT_TIMEOUT |
Agent timeout (seconds) | 300 |
A2A_ENABLED |
Enable A2A protocol | True |
PYTHONPATH=. pytest evals/MIT