-
The official a2a-python SDK from Google has been frequently updated, and our tutorial needs to keep up. In this article, we'll implement a simple CurrencyAgent using version 0.2.3 of the a2a-python SDK.
-
InfluxDB
InfluxDB – Built for High-Performance Time Series Workloads. InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.
-
The project source code is available at a2a-python-currency. Stars are welcome!
-
uvicorn.run(server_app_builder.build(), ...): A2AStarletteApplication has a build() method that builds the actual Starlette application. Then use uvicorn.run() to run this application, making your agent accessible via HTTP. host='0.0.0.0' makes the server accessible on all network interfaces of your machine. port=9999 specifies the port to listen on. This matches the url in the AgentCard.
-
uv run python test_currency_agent.py INFO:__main__: Testing query: What is the current exchange rate from USD to EUR? INFO:httpx:HTTP Request: POST https://openrouter.ai/api/v1/chat/completions "HTTP/1.1 200 OK" INFO:__main__:Response: {'is_task_complete': False, 'require_user_input': False, 'content': 'Looking up the exchange rates...'} INFO:__main__:Response: {'is_task_complete': False, 'require_user_input': False, 'content': 'Processing the exchange rates...'} INFO:httpx:HTTP Request: GET https://api.frankfurter.app/latest?from=USD&to=EUR "HTTP/1.1 200 OK" INFO:currency_agent:API response: {'amount': 1.0, 'base': 'USD', 'date': '2025-05-20', 'rates': {'EUR': 0.8896}} INFO:httpx:HTTP Request: POST https://openrouter.ai/api/v1/chat/completions "HTTP/1.1 200 OK" INFO:currency_agent:Final message: {'role': 'assistant', 'content': '{\n "status": "completed",\n "message": "The current exchange rate from USD to EUR is 0.8896. This means that 1 US Dollar equals 0.8896 Euros as of May 20, 2025."\n}', 'refusal': None, 'reasoning': None} INFO:__main__:Response: {'is_task_complete': True, 'require_user_input': False, 'content': 'The current exchange rate from USD to EUR is 0.8896. This means that 1 US Dollar equals 0.8896 Euros as of May 20, 2025.'}