🌿 Eco-Nomad Swarm: 100% Real-Data Sustainable Travel Orchestration

Source notebook

Repo path: gemini/use-cases/graphrag/tourism_agentic_graph_rag_neo4j.ipynb · Open on GitHub · advanced

Builds a Vertex AI ADK travel swarm using Neo4j GraphRAG and live APIs for sustainable trip briefs.

Summary

This notebook teaches how to build an Eco-Nomad travel orchestrator that chains Neo4j GraphRAG, live country, forex, weather, web search, and translation tools. It seeds a sustainable rail topology into Neo4j, wraps each live data source as a Python tool, binds them to ADK agents using Gemini, then deploys the orchestrator with Vertex AI reasoning engines. It also visualizes the graph with pyvis.

Key code patterns

Neo4j graph seeding

graph = Neo4jGraph(url=NEO4J_URI, username=NEO4J_USER, password=NEO4J_PASSWORD, database=NEO4J_DATABASE)
cypher = """
MERGE (mumbai:City {name: 'Mumbai'})-[:IN]->(in)
MERGE (delhi:City {name: 'New Delhi'})-[:IN]->(in)
MERGE (mumbai)-[r4:TRAIN_ROUTE {train_type: 'Rajdhani Express', duration_hrs: 15.5}]->(delhi)
SET r4.co2_saved_vs_flying_kg = 145
"""
graph.query(cypher)

Creates the graph topology that the travel agent later queries for routes, countries, and CO2 savings.

GraphRAG Cypher QA tool

llm = VertexAI(model_name="gemini-2.0-flash", temperature=0)
chain = GraphCypherQAChain.from_llm(
    llm=llm,
    graph=graph,
    verbose=True,
    allow_dangerous_requests=True,
)
return chain.invoke(question)["result"]

Turns natural-language route questions into Neo4j Cypher-backed answers using Gemini through LangChain.

Live REST API tool

url = f"https://api.frankfurter.app/latest?amount={amount}&from={from_currency}&to={to_currency}"
data = requests.get(url, timeout=5).json()
converted = data.get("rates", {}).get(to_currency)
return f"Live Rate (Date: {data.get('date')}): {amount} {from_currency} = {converted} {to_currency}."

Shows the notebook’s zero-mock pattern: agent tools fetch real external data at runtime.

ADK orchestrator agent

eco_orchestrator = Agent(
    name="EcoOrchestrator",
    model="gemini-2.5-flash",
    instruction="""Use EcoPathfinder, DemographicsDesk, TreasuryDesk, ClimateDesk,
    WebIntelligence, and LinguistDesk to compile REAL data.""",
    tools=[query_eco_graph, get_country_intelligence, live_currency_conversion,
           get_live_weather, search_live_web, translate_text],
)

Defines one coordinating ADK agent that chains graph, currency, weather, search, and translation tools.

Vertex AI deployment

remote_swarm = reasoning_engines.ReasoningEngine.create(
    RealDataSwarmWrapper(reasoning_engines.AdkApp(agent=eco_orchestrator), PROJECT_ID, REGION),
    requirements=["google-adk>=1.0.0", "langchain-community", "requests", "deep-translator"],
)

Packages the ADK app and its runtime dependencies for managed Vertex AI execution.

Models & APIs used

  • Models: gemini-2.0-flash, gemini-2.5-flash
  • APIs / services: Vertex AI, Vertex AI Reasoning Engine, Cloud Storage, Neo4j, RESTCountries API, Frankfurter API, Open-Meteo API, DuckDuckGo Search API, Deep-Translator API
  • SDKs / libraries: google-adk, google-cloud-aiplatform, vertexai, langchain-google-vertexai, langchain-community, neo4j, pyvis, duckduckgo-search, requests, deep-translator, ddgs

When to use this

Use this pattern when a travel or planning agent must combine graph relationships with live external data and deploy through Vertex AI.

Gotchas & caveats

  • Requires a Google Cloud project with billing enabled and the Vertex AI API enabled.
  • Requires the Vertex AI User IAM role on the project.
  • Requires valid Neo4j URI, user, password, and database values before seeding or querying the graph.
  • The local AdkApp sandbox is described as having Colab authentication issues because it expects GCE metadata credentials.
  • The GraphCypherQAChain is created with allow_dangerous_requests=True, which requires care around generated Cypher execution.
  • Deployment requirements must include runtime dependencies such as requests, deep-translator, duckduckgo-search, Neo4j, LangChain, ADK, and google-cloud-aiplatform.
  • The staging bucket is derived as gs://{PROJECT_ID}-vertex-staging and must be usable for Vertex AI deployment.

Best practices

  • Use live databases or real-world REST endpoints instead of mocked travel, weather, forex, or translation data.
  • Chain tool outputs deterministically, such as graph-derived country to RESTCountries currency to Frankfurter forex conversion.
  • Keep agent tools narrow and domain-specific: graph routing, demographics, treasury, climate, web intelligence, and translation.
  • Use exact 3-letter currency codes for live currency conversion.
  • Initialize Vertex AI with project, region, and a staging bucket before production deployment.
  • Include required Python packages in ReasoningEngine deployment requirements.