An open-source Agent2Agent (A2A) compliant server that provides Google Maps capabilities to other agents via a standardized protocol.
This project implements the Agent2Agent (A2A) protocol created by Google, which enables different AI agents to communicate and collaborate with each other using a standardized interface.
- A2A Protocol Compliance: Implements the Agent2Agent protocol for seamless agent-to-agent communication
- Google Maps API Integration: Provides access to various Google Maps services:
- Geocoding (address to coordinates)
- Reverse geocoding (coordinates to address)
- Directions between locations
- Places search
- Place details
- Distance matrix calculations
- Task Lifecycle Management: Handles the entire task lifecycle (created, in-progress, completed, failed)
- Capability Discovery: Provides an agent card that describes available capabilities
- Security: Basic API key authentication
- Usage Guide - Detailed instructions on how to use the API
- A2A Implementation Details - Information about how this server implements the A2A protocol
- Python 3.8+
- Google Maps API key
- Docker (optional, for containerized deployment)
-
Clone the repository:
git clone https://github.com/pab1it0/google-maps-a2a.git cd google-maps-a2a
-
Create a virtual environment and install dependencies:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
-
Configure environment variables:
# Create a .env file cp .env.example .env # Edit .env with your keys
-
Run the server:
uvicorn main:app --reload
-
Build the Docker image:
docker build -t google-maps-a2a .
-
Run the container:
docker run -p 8000:8000 \ -e API_KEY=your_api_key_here \ -e GOOGLE_MAPS_API_KEY=your_google_maps_api_key_here \ google-maps-a2a
To discover the server's capabilities, send a GET request to the /agent-card
endpoint:
curl http://localhost:8000/agent-card
To create a new task, send a POST request to the /tasks
endpoint:
curl -X POST http://localhost:8000/tasks \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key_here" \
-d '{
"type": "geocode",
"input": {
"format": "text",
"content": "1600 Amphitheatre Parkway, Mountain View, CA"
}
}'
To check the status of a task, send a GET request to the /tasks/{task_id}
endpoint:
curl http://localhost:8000/tasks/your-task-id-here \
-H "X-API-Key: your_api_key_here"
To execute a task, send a PUT request to the /tasks/{task_id}/execute
endpoint:
curl -X PUT http://localhost:8000/tasks/your-task-id-here/execute \
-H "X-API-Key: your_api_key_here"
This server follows the Agent2Agent (A2A) protocol specification for agent communication:
- Agent Card: Provides a standardized descriptor of capabilities
- Task-based Interaction: Uses a task-oriented approach for handling requests
- Standardized Formats: Supports multiple input/output formats
- Status Tracking: Manages the full lifecycle of tasks
Once the server is running, you can access the Swagger UI documentation at:
http://localhost:8000/docs
The project includes a test suite to ensure functionality:
python -m pytest test_server.py -v
API_KEY
: The API key for accessing the serverGOOGLE_MAPS_API_KEY
: Your Google Maps API key
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Google's Agent2Agent (A2A) Protocol for the interoperability specification
- Google Maps Platform for their mapping services
- FastAPI for the web framework