A currency conversion AI agent demonstrating A2A + ADK + MCP working together, powered by the AllRatesToday exchange rate API.
It uses the Agent2Agent (A2A) Python SDK (a2a-sdk), Google's Agent Development Kit (google-adk), and a FastMCP server that exposes live, historical, and reference exchange rate data from AllRatesToday.
- MCP Server β exposes five tools backed by allratestoday.com, with built-in response caching, timeouts, and retry with backoff:
Tool Description get_exchange_rateLive exchange rate between two currencies, with optional amount conversion compare_ratesOne base currency vs. several targets at once (e.g. USD vs EUR, GBP, JPY) get_historical_ratesHistorical rates over a period ( 1d,7d,30d,1y)get_rate_changeTrend over a period β start/end rate, change %, direction up/down list_currencies150+ supported ISO 4217 currencies with names and symbols - ADK Agent β orchestrates the conversation and invokes the MCP tools when needed.
- A2A Server/Client β advertises the agent over the Agent2Agent protocol so other agents can call it.
- Multi-agent demo β a second
travel_budget_agentthat delegates currency questions to the currency agent over A2A (see below).
- Python 3.10+
- A free AllRatesToday API key β sign up at allratestoday.com/register (no card required)
- A Google AI Studio API key (for the default Gemini model β see Using other models for alternatives)
- Clone the repository:
git clone https://github.com/AllRates-Today/currency-agent.git
cd currency-agent- Install uv (used to manage dependencies):
curl -LsSf https://astral.sh/uv/install.sh | sh- Configure environment variables:
cp .env.example .env
# then edit .env and set ALLRATES_API_KEY and GOOGLE_API_KEYTerminal 1 β MCP server:
export $(grep -v '^#' .env | xargs) # or rely on your shell env
uv run mcp-server/server.pyTerminal 2 β A2A server (ADK agent):
uv run uvicorn currency_agent.agent:a2a_app --host localhost --port 10000Terminal 3 β A2A client:
uv run currency_agent/test_client.pyALLRATES_API_KEY=art_live_... GOOGLE_API_KEY=... docker compose up --build
# then, in another terminal:
uv run currency_agent/test_client.py- "How much is 500 USD in LKR?"
- "Compare USD against EUR, GBP and JPY."
- "Is the euro up or down against the dollar this week?"
- "Show me the USD/EUR trend over the last 30 days."
- "Do you support the Sri Lankan rupee?"
travel_agent/ contains a second agent β a travel budget planner β that has no
exchange-rate tools of its own. Whenever it needs a rate, it calls the currency agent
over the A2A protocol, which is the actual point of A2A: agents consuming other
agents as peers, not as bundled tools.
With Terminals 1 and 2 from above still running:
# Terminal 3 β travel agent (A2A server on port 10001)
uv run uvicorn travel_agent.agent:a2a_app --host localhost --port 10001
# Terminal 4 β ask it something
uv run travel_agent/test_client.py
# "I have 2000 USD for a 5-day trip to Japan. What is my total and daily budget in JPY?"| Env var | Default | Description |
|---|---|---|
ALLRATES_API_KEY |
β (required) | Your AllRatesToday API key |
GOOGLE_API_KEY |
β | Google AI Studio key (required for Gemini models) |
MODEL |
gemini-2.5-flash |
Agent model β see below |
MCP_SERVER_URL |
http://localhost:8080/mcp |
Where the agent finds the MCP server |
CURRENCY_AGENT_URL |
http://localhost:10000 |
Where the travel agent finds the currency agent |
ALLRATES_BASE_URL |
https://allratestoday.com/api |
API base URL override |
PORT |
8080 |
MCP server port |
Non-Gemini models are routed through LiteLLM:
uv pip install litellm # or: pip install 'allratestoday-currency-agent[litellm]'
export MODEL=anthropic/claude-sonnet-4-6 ANTHROPIC_API_KEY=sk-ant-...
# or: export MODEL=openai/gpt-4o OPENAI_API_KEY=sk-...uv pip install fastmcp==2.11.3 httpx pytest ruff
pytest # unit tests (httpx mocked β no API key needed)
ruff check . # lint
uv run mcp-server/test_server.py # integration test against a running MCP serverCI runs lint + tests on every push (see badge above).
If you just want exchange rate tools in your MCP client (without ADK/A2A), use the production allratestoday-mcp server:
{
"mcpServers": {
"allratestoday": {
"command": "npx",
"args": ["-y", "@allratestoday/mcp-server"],
"env": { "ALLRATES_API_KEY": "art_live_..." }
}
}
}AllRatesToday is a fast, developer-friendly exchange rate API with live and historical rates for 150+ currencies, a generous free tier, and SDKs/integrations including an MCP server.
Based on the excellent jackwotherspoon/currency-agent sample (Apache 2.0), adapted to use the AllRatesToday API.
