AI agents are becoming increasingly sophisticated, but most lack real-world spatial awareness. Today, we'll show you how to build intelligent location-aware agents using DeepAgents and Camino AI that can understand, research, and reason about places and locations.
What We're Building
We'll create an AI research agent that combines:
- Location Intelligence via Camino AI
- Web Search Capabilities via Tavily
- Sophisticated Reasoning via DeepAgents
This agent can answer complex queries like:
- "What are the best coffee shops in Paris?"
- "Find family-friendly restaurants near Golden Gate Bridge"
- "Research the startup ecosystem around MIT"
Prerequisites
pip install deepagents camino-ai-sdk tavily-python python-dotenv
You'll need API keys for:
- Camino AI - For location intelligence
- Tavily - For web search
- Anthropic - For the language model (used by DeepAgents)
The Complete Implementation
import os
from typing import Literal
from tavily import TavilyClient
from camino_ai import CaminoAI, APIError
from deepagents import create_deep_agent
from dotenv import load_dotenv
load_dotenv()
# Initialize clients
tavily_client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"])
camino_client = CaminoAI(api_key=os.environ.get("CAMINO_API_KEY"))
def internet_search(
query: str,
max_results: int = 5,
topic: Literal["general", "news", "finance"] = "general",
include_raw_content: bool = False,
):
"""
Run a web search to find current information and context.
Use this for general research, news, reviews, and background information
that complements location data.
"""
try:
return tavily_client.search(
query,
max_results=max_results,
include_raw_content=include_raw_content,
topic=topic,
)
except Exception as e:
return f"Web search error: {str(e)}"
# Define the agent's research methodology
research_instructions = """You are an expert location researcher and travel advisor.
Your mission is to provide comprehensive, actionable insights about places, businesses, and locations.
## Your Tools
You have access to multiple Camino AI location intelligence tools:
**`query`**: General location search for finding places, businesses, restaurants, hotels, attractions, etc. This tool understands natural language queries like "coffee shops in downtown Seattle" or "family restaurants near Central Park."
**`search`**: Alternative search method with different ranking algorithms.
**`context`**: Get contextual information about a specific location or area.
**`journey`**: Plan routes and journeys between multiple locations.
**`relationship`**: Understand spatial relationships between locations.
**`internet_search`**: Use this for gathering additional context, reviews, recent news, opening hours, pricing, or any supplementary information about locations you've found.
## Research Methodology
1. **Location Discovery**: Start with Camino AI tools to find relevant places
2. **Context Gathering**: Use internet_search to get reviews, recent information, and context
3. **Synthesis**: Combine location data with web research for comprehensive insights
4. **Recommendations**: Provide specific, actionable recommendations with reasoning
## Output Format
Structure your responses as:
- **Summary**: Brief overview of findings
- **Top Recommendations**: 3-5 specific places with details
- **Insights**: Key patterns, trends, or notable findings
- **Practical Tips**: Hours, pricing, reservation info, etc.
Always cite your sources and be specific about locations, addresses, and practical details.
"""
# Create the location-aware research agent with all Camino AI tools
agent = create_deep_agent(
tools=[
camino_client.search,
camino_client.query,
camino_client.context,
camino_client.journey,
camino_client.relationship,
internet_search
],
instructions=research_instructions,
)
# Example usage
if __name__ == "__main__":
queries = [
"What are the best coffee shops in Paris?"
]
for query in queries:
print(f"\n🔍 Query: {query}")
print("=" * 50)
result = agent.invoke({
"messages": [{"role": "user", "content": query}]
})
print(result['messages'][-1])
Why This Combination Works
🎯 Camino AI Advantages
- Natural Language Understanding: Handles queries like "quiet coffee shops for work"
- AI-Powered Ranking: Results ranked by relevance and quality
- Spatial Reasoning: Understands proximity, directions, and relationships
- Structured Data: Clean, consistent location information
🌐 Tavily Integration
- Current Information: Reviews, hours, recent changes
- Context and Background: Neighborhood insights, trends
- Verification: Cross-reference location data with web sources
🤖 DeepAgents Framework
- Multi-Step Reasoning: Plans research methodology
- Tool Coordination: Intelligently combines location and web data
- Adaptive Responses: Adjusts approach based on query type
Advanced Use Cases
Travel Planning Agent
travel_query = """
Plan a perfect day in San Francisco for a tech entrepreneur visiting for the first time.
Include must-see tech landmarks, great coffee shops for meetings, and dinner recommendations.
"""
result = agent.invoke({
"messages": [{"role": "user", "content": travel_query}]
})
Market Research Agent
market_query = """
Analyze the restaurant scene in Brooklyn's DUMBO neighborhood.
What types of cuisines are popular? Any gaps in the market?
"""
result = agent.invoke({
"messages": [{"role": "user", "content": market_query}]
})
Real Estate Analysis
real_estate_query = """
Evaluate the amenities and walkability around 123 Main St, Boston.
What restaurants, shops, and services are within walking distance?
"""
result = agent.invoke({
"messages": [{"role": "user", "content": real_estate_query}]
})
Real-World Results
Here's what our agent produced for "best coffee shops in Paris" (view full trace on LangSmith):
Summary
Paris has evolved from traditional café culture to embrace world-class specialty coffee, with numerous excellent third-wave coffee shops scattered throughout the city. The scene combines traditional Parisian café ambiance with modern coffee expertise, featuring local roasters and international beans.
Top Recommendations
1. Télescope Café ⭐⭐⭐⭐⭐
- Address: 5 Rue Villedo, 75001 Paris (1st arrondissement)
- Hours: Monday-Friday 8:30am-4:00pm (closed weekends)
- Specialty: Pioneer of Paris's specialty coffee scene, excellent flat whites
- What makes it special: Small, intimate space known for expertly crafted coffee using beans from Belgian roaster Caffènation
2. Ten Belles ⭐⭐⭐⭐⭐
- Multiple locations:
- Original: 10 Rue de la Grange aux Belles, 75010 Paris (Canal Saint-Martin)
- Bastille: 17-19 Rue Bréguet, 75011 Paris
- Saint-Germain: 6th arrondissement location
- Hours: Generally 8:00am-5:00pm (varies by location)
- Specialty: Own coffee roastery, excellent sourdough bread and pastries
- What makes it special: Australian-influenced café with exceptional coffee and food
3. Le Peloton Café ⭐⭐⭐⭐
- Address: Rue du Pont Louis-Philippe, Le Marais (4th arrondissement)
- Specialty: Coffee and bicycle rentals - unique concept
- What makes it special: Located in the heart of Le Marais, combines excellent coffee with bike rental services
4. Café de Flore ⭐⭐⭐⭐ (Historic)
- Address: 172 Boulevard Saint-Germain, 75006 Paris (6th)
- Hours: Daily 7:30am-1:30am
- What makes it special: Legendary café frequented by intellectuals like Sartre and de Beauvoir
5. Les Deux Magots ⭐⭐⭐⭐ (Historic)
- Address: Place Saint-Germain-des-Prés, 75006 Paris (6th)
- Hours: Daily 7:30am-1:00am
- What makes it special: Iconic literary café with outdoor terrace perfect for observing Parisian life
Insights
- Third-Wave Coffee Movement: Paris has fully embraced specialty coffee culture with local roasters like Belleville Brûlerie, Partisan, and KB Coffee Roasters
- Geographic Distribution: Le Marais (3rd-4th) and Canal Saint-Martin (10th) have high concentrations of trendy coffee shops
- Coffee Culture Evolution: Traditional café culture coexists beautifully with modern specialty coffee
Practical Tips
- Hours: Most specialty coffee shops close earlier than traditional cafés (typically 4-5pm)
- Pricing: Specialty coffee shops charge €3-5 for espresso drinks, traditional cafés €1.50-3
- Language: Baristas at specialty shops typically speak English; a friendly "bonjour" goes a long way
- Best Times: Visit specialty shops mid-morning for the freshest coffee and best atmosphere
Best Practices
1. Query Optimization
- Be specific about location and preferences
- Include context like "for families" or "budget-friendly"
- Mention proximity requirements when relevant
2. Tool Selection Strategy
- Use
location_queryfirst for discovery - Follow with
internet_searchfor validation and context - Combine insights for comprehensive recommendations
3. Error Handling
def robust_location_query(query: str, max_results: int = 5):
try:
response = camino_client.query(query, limit=max_results)
if not response.get('results'):
return f"No locations found for: {query}"
return response
except APIError as e:
return f"Location service temporarily unavailable: {str(e)}"
Cost Optimization
- Camino AI: $0.001 per query (1000x cheaper than Google Places)
- Tavily: Pay-per-search model
- Anthropic: Usage-based pricing
Combined cost typically under $0.01 per complex research query.
Deployment Options
Local Development
export CAMINO_API_KEY="your_camino_key"
export TAVILY_API_KEY="your_tavily_key"
export ANTHROPIC_API_KEY="your_anthropic_key"
python location_agent.py
Production Deployment
- Deploy on AWS Lambda, Google Cloud Functions, or similar
- Use environment variables for API key management
- Implement caching for frequently requested locations
- Add rate limiting and usage monitoring
Get Started Today
Ready to build location-intelligent agents?
- Get your Camino AI API key: app.getcamino.ai
- Install the packages:
pip install deepagents camino-ai-sdk tavily-python python-dotenv - Copy the code above and start experimenting
- Join our community: Share your builds and get help
About Camino AI: We provide affordable location intelligence APIs for AI agents, offering natural language processing, routing, and spatial reasoning at 17x less cost than traditional alternatives.