How qizhengzhong111/agent_orchestrator works
Project type and purpose
• This is a backend-centric, multi-agent orchestration service written in Python. It exposes a FastAPI endpoint, uses LangGraph to drive a graph-based workflow, and routes natural-language user requests to one of three agents (data preparation, reconciliation, fallback). It also integrates with external services (Azure OpenAI).
File structure
• DemoData/ (CSV files used by two agents)
• config.json (agent-specific settings, e.g., model names, parameters)
• acquire_access_token.py (module to fetch OAuth tokens for Azure OpenAI)
• langgraph_lite.py (defines StateGraph, router node, agents, conditional edges, graph.compile())
• multiagentchat.py (FastAPI app exposing a POST /multiagentchat endpoint)
• requirements.txt, README.md
README for insights
• Confirms three agents behind a router node in a graph, compiled into multiagent_app
• FastAPI service on port 8001
• .env holds OPENAI_API_KEY for Azure integration
• DemoData feeds the finance-specific agents
a. Main components
• User / Frontend (or any HTTP client)
• FastAPI Service (multiagentchat.py)
• Orchestration Engine (langgraph_lite.py → StateGraph)
– Router Node
– data_preparation Agent
– reconciliation Agent
– fallback Agent
• Configuration / Token modules
– config.json
– acquire_access_token.py / .env
• Data Store (DemoData CSV files)
• External Service (Azure OpenAI API)
b. Relationships & data flows
1. User sends JSON {"input": "..."} → FastAPI endpoint
2. FastAPI calls multiagent_app.invoke({"input": ...})
3. Orchestration Engine’s router node examines input → chooses agent
4. Chosen agent may:
• Read/write DemoData CSVs
• Call acquire_access_token.py to get token
• Invoke Azure OpenAI with token + prompt
5. Agent returns result → graph returns to FastAPI → HTTP response
c. Architectural patterns / principles
• Workflow / state-graph pattern (LangGraph)
• Modular agents behind a single entry point
• Clear separation of concerns: API layer, orchestration layer, agents, configuration, data, external services
d. Key technologies
• Python 3.x, FastAPI (HTTP service)
• LangGraph (workflow engine)
• Azure OpenAI (LLM calls)
• CSV file store for demo data
Detail
• Don’t just show “Backend” as a block—break it into FastAPI, orchestration engine, token module, each agent, config, and DemoData.
• Entry points, data stores, external dependencies, and workflow transitions precisely.