Tools for interacting with Google Maps services including place search, directions, geocoding, and more
GoogleMapTools enable an Agent to interact with various Google Maps services for location-based operations including place search, directions, geocoding, and more.
Prerequisites
The following example requires the googlemaps library and an API key which can be obtained from the Google Cloud Console.
pip install googlemaps
export GOOGLE_MAPS_API_KEY=your_api_key_here
You’ll need to enable the following APIs in your Google Cloud Console:
Places API
Directions API
Geocoding API
Address Validation API
Distance Matrix API
Elevation API
Time Zone API
Example
Basic usage of the Google Maps toolkit:
from agno.agent import Agentfrom agno.tools.google_maps import GoogleMapToolsagent = Agent(tools=[GoogleMapTools()], show_tool_calls=True)agent.print_response("Find coffee shops in San Francisco")
Optional API key. If not provided, uses GOOGLE_MAPS_API_KEY environment variable
search_places
bool
True
Enable places search functionality
get_directions
bool
True
Enable directions functionality
validate_address
bool
True
Enable address validation functionality
geocode_address
bool
True
Enable geocoding functionality
reverse_geocode
bool
True
Enable reverse geocoding functionality
get_distance_matrix
bool
True
Enable distance matrix functionality
get_elevation
bool
True
Enable elevation functionality
get_timezone
bool
True
Enable timezone functionality
Toolkit Functions
Function
Description
search_places
Search for places using Google Maps Places API. Parameters: query (str) for the search query. Returns stringified JSON with place details including name, address, phone, website, rating, and hours.
get_directions
Get directions between locations. Parameters: origin (str), destination (str), optional mode (str) for travel mode, optional avoid (List[str]) for features to avoid. Returns route information.