The travel orchestrator runs seven processes in a fixed order before it answers one question
A multi-agent travel assistant system built using the **Agent2Agent (A2A)** protocol and **MCP (Model Context Protocol)**
At a glance
- What is it?
- A Python reference for the A2A protocol where a single orchestrator classifies intent, three A2A agents each generate SQL, and three MCP servers hold the database. Every agent is a separate port, and the documentation spells out the startup order because the dependencies break otherwise.
- Who is it for?
- Use it if you want a concrete A2A wiring example rather than a library, since the port map and the startup order are the teaching material and the code is short enough to read in one sitting. Do not expect production behaviour from it: credentials sit in config.py as literals, every layer is a separate process you start by hand, and the test directory is a set of scripts you run against services you already launched.
- Can I use it commercially?
- Not without permission. GitHub finds no licence file in the repository, and without a licence all rights are reserved by default: you may read the code but not reuse it. Check the README, or ask the authors, before using it.
- Is it still maintained?
- Yes. The repository last received commits 96 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.
Star history
- phoenix-zhou/multi-agent490 ★ · +180
| Repository | 2026-09-17 | 2026-11-15 |
|---|---|---|
| phoenix-zhou/multi-agent | 310 | 490 |
180 Stars in the last 59 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
Intent is collapsed into seven labels before anything else happens
Everything the system can do is decided by one classification step. The orchestrator maps a user message onto a fixed set of intent labels, and those labels determine the route:
用户输入 → 意图识别(LLM) → 路由到对应 Agent
├─ out_of_scope / 追问 → 直接回复
├─ attraction → LLM 直接生成景点推荐
└─ weather/flight/train/concert/order
→ A2A Agent 生成 SQL (LLM)
→ 调用 MCP 工具查询数据库
→ 返回结果 → 总控中心 LLM 总结 → 用户Six data-bearing intents route to an agent, attraction is answered by the orchestrator's own model with no database at all, and out_of_scope plus follow-up questions return text directly. The seven-label set is weather, flight, train, concert, order, attraction and out_of_scope.
So one out of seven routes never leaves the orchestrator, and the classification is the only place a new capability has to be registered.
Six ports across two layers, and the startup order is not optional
The port table is the architecture in miniature. Three A2A agents occupy 5005, 5006 and 5007 for weather, ticket queries and ticket ordering. Three MCP servers occupy 8002, 8001 and 8003 for weather tools, ticket tools and order tools. The Streamlit interface sits on 8501.
Note that the ticket pair is not ordered by layer number: the ticket MCP server is on 8001 while the weather one is on 8002. The numbering follows the order tools were written rather than any dependency, so the numbers carry no information.
The launch sequence is three numbered groups, and it has to run in that order because an A2A agent calls an MCP server over HTTP:
# ① 启动 MCP Server(数据层)
python mcp_server/mcp_weather_server.py # 端口 8002
python mcp_server/mcp_ticket_server.py # 端口 8001
python mcp_server/mcp_order_server.py # 端口 8003
# ② 启动 A2A Agent(智能体层)
python a2a_server/weather_server.py # 端口 5005
python a2a_server/ticket_server.py # 端口 5006
python a2a_server/order_server.py # 端口 5007Then one of two front ends, main.py for the command line or streamlit run app.py for the web chat. There is no supervisor, so a crashed data server surfaces as a failing agent rather than as a restart.
Each agent turns a request into SQL and asks the user when it cannot
The data agents share one mechanism. An A2A agent receives natural language, asks the model to produce SQL, passes the database schema along as prompt context, and hands that SQL to an MCP tool.
Two failure paths are built into that loop. When the request lacks information, the agent returns an input_required marker and asks the user rather than guessing a query. When the question is unrelated, it refuses instead of answering.
That is the part worth copying. A text-to-SQL agent that invents a column name produces a runtime error, and one that invents a filter produces a plausible wrong answer, so the system answers only what it can build a query for.
The MCP tools themselves are named by domain, including query_weather, query_tickets and order_train, and they are called over HTTP with streaming rather than being imported as Python functions.
The order agent calls the query agent before it calls the booking tool
Ticket ordering is the one place where two agents talk to each other, and the sequence is deliberate. The order agent first calls the ticket query agent to confirm availability, then concatenates that availability information into the request it sends to the MCP ordering tool.
The design note puts it plainly: check remaining inventory first, then execute the booking. Nothing here retries a failed booking against a stale inventory check, because the check and the write happen inside one agent turn.
It is also the only cross-agent call in the design. Weather, ticket queries and attraction recommendations each terminate in one agent, and everything else terminates in the orchestrator, so the collaboration pattern is one path rather than a general capability.
Query rewriting hides context from every downstream agent
The orchestrator keeps conversation memory and uses it before routing. Its job is to rewrite an incomplete question such as 那明天呢 into a complete one, so that the agent receiving it never needs the history.
The consequence is that downstream agents can be written as stateless request handlers. An agent sees one sentence, produces one SQL query, returns rows, and knows nothing about what was asked before.
That also moves a failure mode upward. If the rewrite resolves the wrong referent, the agent downstream cannot detect it, since the ambiguity was removed before it arrived. The prompts for intent recognition, summarization and attraction recommendations all live in main_prompts.py, so the behaviour you inherit from this repository depends heavily on three templates rather than on the agents.
Credentials are literals in config.py and the database name differs per script
Configuration is a single edited file, with the values written out as assignments:
# 大模型配置
self.base_url = 'https://api.siliconflow.cn/v1'
self.api_key = 'sk-xxx' # 替换为你的 API Key
self.model_name = 'Qwen/Qwen2.5-72B-Instruct'
# 数据库配置
self.host = 'localhost'
self.user = 'root'
self.password = '123456'
self.database = 'travel_rag'The API key placeholder is sk-xxx and the password is a literal six-digit example, both meant to be replaced. Nothing reads from environment variables, so there is no supported way to keep a real key out of the file other than editing it and hoping it does not get committed.
The database setup script also disagrees with itself. The schema script runs against whatever the login defaults to, and the sample data import names travel_rag explicitly:
mysql -u root -p < sql/sql_data.sql
mysql -u root -p travel_rag < sql/insert2.sqlReal weather data is a separate step, python utils/spider_weather.py, which needs a QWeather API key configured. Until you run it, the weather tools have no rows to query.
Tests are six scripts that require the services already running
The test directory holds six standalone scripts rather than a suite with fixtures:
python test/test_weather_mcp_server.py
python test/test_weather_agent_server.py
python test/test_ticket_mcp_server.py
python test/test_ticket_agent_server.py
python test/test_order_mcp_server.py
python test/test_order_agent_server.pyThe instruction is that you start the corresponding service first and then run the script. So each MCP server and each agent is probed separately, which is a reasonable way to check six independent processes, and none of it exercises the orchestrator or the agents talking to each other.
The CLI also has a diagnostic built in. Typing cards lists every agent's card with its skills, description and address, which is the fastest way to confirm that the three agents registered themselves correctly after startup.
Editorial conclusion
Use it if you want a concrete A2A wiring example rather than a library, since the port map and the startup order are the teaching material and the code is short enough to read in one sitting. Do not expect production behaviour from it: credentials sit in config.py as literals, every layer is a separate process you start by hand, and the test directory is a set of scripts you run against services you already launched. Before adapting it, decide whether your data belongs behind MCP at all, because the agents here are text-to-SQL wrappers and that decision is what the whole architecture turns on.
Frequently asked questions
What ports does the multi-agent travel assistant use?
Three A2A agents on 5005, 5006 and 5007 for weather, ticket queries and ordering. Three MCP servers on 8002, 8001 and 8003 for weather, ticket and order tools. The Streamlit interface runs on 8501 by default.
In what order do I start the multi-agent services?
Data layer first: the three MCP servers. Then the three A2A agents, which call the MCP servers over HTTP. Finally one front end, either python main.py for the CLI or streamlit run app.py for the web chat interface.
How do the A2A agents answer a question in the multi-agent travel assistant?
Each agent asks the model to convert natural language into SQL, supplies the database schema as prompt context, and calls an MCP tool with the result. If information is missing it returns input_required and asks the user; if the question is unrelated it refuses.
Which languages does the multi-agent travel assistant use?
Python 3.9 or newer, with Streamlit, LangChain, langchain-openai, python-a2a, mcp, langchain-mcp-adapters, mysql-connector-python, requests, schedule and pytz. The model is reached through an OpenAI-compatible SiliconFlow endpoint and can be swapped.
How does the multi-agent order flow check availability before booking?
The order agent calls the ticket query agent to confirm remaining inventory, then passes that availability information to the MCP ordering tool. It is the only place where one agent calls another in this design.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/phoenix-zhou-multi-agent)Star history chart for your README
[](https://hysenlabs.com/projects/phoenix-zhou-multi-agent)Was this useful?