Skip to main content

AI Route Planning Agent — Spatial-RAG + TSP + Interactive CLI

Project description

ARAHIN — AI ReAct Agent for Hybrid Itinerary Navigation

Spatial-RAG + TSP + Interactive CLI

ARAHIN (AI ReAct Agent for Hybrid Itinerary Navigation) is an AI agent that plans multi-stop routes from natural language descriptions. It uses a ReAct loop — LLM calls tools (geocode, spatial search, POI lookup) to identify waypoints, then optimizes the route via OR-Tools TSP and renders an interactive Folium map.

Works for any city in the world with OpenStreetMap data. No ML dependencies, no FAISS, no pre-built index.

      █████╗ ██████╗  █████╗ ██╗  ██╗██╗███╗   ██╗
     ██╔══██╗██╔══██╗██╔══██╗██║  ██║██║████╗  ██║
     ███████║██████╔╝███████║███████║██║██╔██╗ ██║
     ██╔══██║██╔══██╗██╔══██║██╔══██║██║██║╚██╗██║
     ██║  ██║██║  ██║██║  ██║██║  ██║██║██║ ╚████║
     ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝╚═╝  ╚═══╝

Install

pipx install arahin

No PyTorch, no CUDA, no FAISS, no heavy ML stack. Dependencies (openai, requests, ortools, folium, rich) total ~30-50 MB installed.

Quick Start

export ARAHIN_API_KEY="sk-..."

# Interactive REPL
arahin

# One-shot with map
arahin "dari Monas ke Taman Mini, mampir sate dekat Cawang" --map

# With turn-by-turn directions
arahin "jalan-jalan di Kota Tua" --map --directions

Example Session

📍 Route Description > saya dari Universitas Muhammadiyah Yogyakarta,
                       saya mau ke Masjid Agung Kauman,
                       saya ingin lewat pasty dan berhenti untuk
                       makan bebek dulu

🧠 Extracting waypoints...
  🤔 geocode("Universitas Muhammadiyah Yogyakarta") → found (-7.8108, 110.3223)
  🤔 geocode("Masjid Agung Kauman") → found (-7.8038, 110.3624)
  🤔 geocode("Pasty Yogyakarta") → found (-7.8257, 110.3544)
  🤔 spatial_rag("bebek goreng", ...) → found 3 restaurants
  ✅ Waypoints: UMY → Pasty → Bebek Goreng H Slamet → Masjid Agung Kauman

📍 Route Description > /map     # opens route.html in browser
📍 Route Description > /dir     # prints turn-by-turn directions

REPL Commands

Command Action
/api <key> Set API key (session only, never written to disk)
/model <name> Switch model (no arg: show current + available)
/map Open route map in browser
/dir Print turn-by-turn directions
/config Show current settings
/help Show help screen
/exit Quit

CLI Flags

Flag Description
query Route description (omit for REPL mode)
--map, -m Open route map in browser
--directions, -d Print turn-by-turn directions
--version Show version

How It Works

User prompt (any city, any language)
  → ReAct Loop (LLM calls geocode / spatial_rag / poi_search)
  → Ordered waypoints JSON
  → Route Optimizer (OSRM matrix → OR-Tools TSP)
  → Ordered route with road geometry
  → Folium interactive map (route.html)

Tools

Tool API Purpose
geocode Nominatim Named places: "Monas", "Universitas Gadjah Mada"
spatial_rag Overpass Natural language: "bebek goreng", "tempat wisata"
poi_search Overpass By category: "cari masjid", "cari restoran"
route OSRM Driving directions + distance matrix
optimizer OR-Tools TSP solver (open or closed path)
render_map Folium Interactive HTML map with distance labels

Requirements

  • API key: OpenCode Go ($ARAHIN_API_KEY or $OPENCODE_API_KEY)
  • LLM: DeepSeek V4 (or any model available on OpenCode Go)
  • Internet: Required (all APIs are online)
  • Disk: ~30-50 MB (ortools is the heaviest dep at ~15 MB)

Project Structure

arahin/
├── cli.py              # Entry point + REPL + 8 commands
├── banner.py           # ASCII splash screen
├── state.py            # Session state singleton
├── agent/
│   ├── controller.py   # ReAct loop with tool dispatch
│   └── prompts.py      # 3 tool schemas + system prompt
├── tools/
│   ├── geocode.py      # Nominatim forward geocode
│   ├── poi_search.py   # Overpass by amenity category
│   ├── spatial_rag.py  # Overpass multi-tag spatial search
│   ├── route.py        # OSRM driving + distance matrix
│   ├── optimizer.py    # TSP solver (brute-force n≤10, OR-Tools n>10)
│   └── render_map.py   # Folium interactive HTML map
├── tests/
│   ├── test_cli.py
│   ├── test_config.py
│   └── test_state.py
└── README.md

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arahin-1.1.1.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arahin-1.1.1-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file arahin-1.1.1.tar.gz.

File metadata

  • Download URL: arahin-1.1.1.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for arahin-1.1.1.tar.gz
Algorithm Hash digest
SHA256 3803aa28b307bb0c0ebd539ea717944423e3b863ee1a339ff8fbbb6554195e17
MD5 487f104fd0df6b3e46c77a9d989783a7
BLAKE2b-256 3c5168e7deb5917a84420ed25e77ba40a70f8e37fec30f8752136b9b4352af35

See more details on using hashes here.

File details

Details for the file arahin-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: arahin-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for arahin-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fcd60eb29dc457b0bedc48f3e03dc54cd6826d3e875cf709a67f66ba6cef0449
MD5 7465641a78d85c378612fb65ab14112b
BLAKE2b-256 bb36ef202887603143f3ab8a1264c89054088871ad8847dc4f8a8167d167f2ef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page