Inspiration
Logistics software often treats drivers as mere data points in a relentless drive for efficiency. We wanted to build a system that remembers the human behind the wheel, especially in a city like Monterrey with its extreme 40°C heat and sudden flash floods. Our goal was to contrast a purely profit-driven approach with a risk-averse model that values safety, wrapping the entire experience in an organic, iOS-inspired interface that feels accessible rather than coldly industrial.
What it does
The Courier is a real-time, asynchronous split-screen simulator for last-mile logistics. It runs two autonomous agents side-by-side through an identical delivery shift using a deterministic seed. The Base Agent (Greedy) blindly accepts orders to maximize immediate points, ignoring environmental hazards. The Smart Agent (Risk-Averse) dynamically balances point density against real-time weather and traffic risks. The system tracks detailed KPIs, including a high-level calculation of points lost to time, providing a holistic view of performance versus safety.
How we built it
The backend is 100% asynchronous, built with Python, FastAPI, and asyncio to prevent event loop blocking. We utilized OSMnx to map origins to Monterrey's actual street graph—ensuring realistic routing rather than flat Euclidean distances—and integrated Google OR-Tools to maximize point collection within strict time windows. The frontend connects via WebSockets to inject live surprise events (like "HEAVY_RAIN") and dynamically update the iOS-styled UI components.
Challenges we ran into
Maintaining perfect determinism across two concurrent asynchronous loops was tough. Both agents had to process the exact same un-seen shift despite variable network latency. Additionally, keeping the agents' decision-making logic strictly under the 200ms timeout without blocking the main event loop required careful architecture, as did accurately projecting raw coordinate data into the largest strongly connected component of the OSMnx graph.
Accomplishments that we're proud of
We successfully built a seamless, concurrent split-screen engine that never drops a frame. We are incredibly proud of the UI; transitioning from a rigid industrial dashboard to a soft, human-centric design makes the data much easier to digest. We also nailed the complex OR-Tools integration to handle mandatory acceptance and point-based routing flawlessly.
What we learned
Optimization isn't just about ruthless speed; it requires a delicate balance between efficiency and the realities of the physical world. Technically, we deepened our grasp of asynchronous Python and spatial graph manipulation. Philosophically, we reinforced the idea that technology should adapt to human limits, not the other way around.
What's next for TARS's Courier Agents
We plan to integrate live weather APIs (like Open-Meteo) to dynamically alter edge weights in OR-Tools based on real-time Monterrey conditions. We also want to introduce driver fatigue metrics into the Smart Agent's logic, pushing further into human-centric logistics that optimize for sustainable, long-term work environments rather than just single-shift burnout.
Built With
- htm
- python
Log in or sign up for Devpost to join the conversation.