How rohitdvv/fleetmind-agentic-trip-assignment works
FleetMind is a dispatch application that assigns trips to eligible drivers and exposes the decision and reasoning to a manager. The main workflow runs from the Streamlit UI through FastAPI, driver filtering, agent/tool evaluation, and persisted assignment back to the UI. Separate capabilities support counterfactual runs, manager overrides, natural-language queries, and scenario evaluations. The README documents these capabilities; some routes and UI sections were not sampled, so their internal wiring is shown only where documented.
Main entry points: backend.py FastAPI routes · agent.py Agent loop · frontend.py Streamlit interface · db.py SQLite queries
Components 19
Dispatcher UI
- Streamlit interface
frontend.py - Fleet views
frontend.py - Trace and what-ifs
frontend.py
API and workflows
- FastAPI routes
backend.py - Trip assignment flow
backend.py - Override and audit
backend.py - Natural-language query
backend.py - Scenario evaluations
evals.py
Assignment decision
- Agent loop
agent.py - Eligibility filter
agent.py - Tool dispatch
tools.py
Fleet data
- SQLite queries
db.py - FleetMind database
fleetmind.db
External services
- Speech recognition
- Address geocoder
frontend.py - LLM client
llm.py
Other components
- Dispatcher
- Nominatim
- OpenAI service
Connections 27
- Dispatcher → Streamlit interface: uses
- Streamlit interface → FastAPI routes: HTTP requests
- Streamlit interface → Speech recognition: transcribes speech
- Streamlit interface → Address geocoder: geocodes addresses
- Address geocoder → Nominatim: looks up locations
- Streamlit interface → Fleet views: renders fleet data
- Streamlit interface → Trace and what-ifs: renders decisions
- FastAPI routes → Trip assignment flow: handles trip requests
- Trip assignment flow → SQLite queries: stores trip and assignment
- Trip assignment flow → Agent loop: runs assignment
- Agent loop → SQLite queries: loads trip and drivers
- Agent loop → Eligibility filter: filters candidates
- Agent loop → Tool dispatch: dispatches tool calls
- Tool dispatch → SQLite queries: reads fleet records
- Agent loop → LLM client: requests completions
- LLM client → OpenAI service: sends prompts
- FastAPI routes → Override and audit: handles overrides
- Override and audit → SQLite queries: records audit and changes
- FastAPI routes → Agent loop: runs counterfactual
- FastAPI routes → Natural-language query: handles questions
- Natural-language query → LLM client: generates SQL
- Natural-language query → SQLite queries: executes SELECT
- FastAPI routes → Scenario evaluations: runs scenarios
- SQLite queries → FleetMind database: reads and writes
- Scenario evaluations → Agent loop: tests fallback scoring
- Fleet views → FastAPI routes: requests fleet data
- Trace and what-ifs → FastAPI routes: requests what-if runs