Project Info
When a heatwave strikes, a disease outbreak surges, or a mass casualty event unfolds, hospitals are suddenly competing for the same scarce supplies, and the phone-call coordination that's supposed to fix it is far too slow. Baymax is a network of hospital AI agents built on Fetch.ai that sees crises coming by fusing live weather, disease, and inventory signals. Using Claude for reasoning, it autonomously negotiates and settles inter-facility transfers on-chain before shortages peak. Every decision is traced through Arize Phoenix, allowing the system to learn from each event and improve future responses. Baymax doesn't just respond to emergencies - it learns to anticipate them. At a Glance Baymax predicts shortages before they happen, negotiates inventory transfers between hospitals, settles them on-chain, and learns from every crisis it handles.
Inspiration
The supply crisis starts long before a hospital runs out. It starts hours earlier, when a weather forecast converges with rising illness signals and a facility that's already running lean. By the time a supply manager notices the pattern—let alone makes phone calls to neighboring facilities, negotiates terms, and arranges a transfer—the shortage has already peaked. The perception problem (counting what's on a shelf) is largely solved. The harder problem is autonomous coordination under surge conditions: seeing a crisis before it happens, negotiating transfers across institutions under real constraints, settling them quickly, and improving the system after every event. That's a multi-agent systems problem. Fetch.ai provides the agent network. Claude provides the reasoning layer. Arize Phoenix closes the learning loop. Baymax is what happens when all three work together. What it Does Baymax runs one agent per hospital. Each agent continuously combines: Live inventory from edge vision systems Weather forecasts and disease-burden signals Historical surge patterns and outcomes When a shortage is predicted: Claude detects a surge risk before inventory reaches critical levels. The requesting hospital broadcasts a transfer request through the Fetch.ai agent network. Nearby hospitals respond with constrained offers. Claude evaluates quantity, urgency, ETA, distance, and expiry dates. If no single offer satisfies demand, Baymax automatically creates a split transfer plan. The transfer is settled through the Fetch Payment Protocol on Dorado testnet. Arize Phoenix traces the entire decision process and outcome. The result is a system that can identify shortages earlier, coordinate faster, and continuously improve over time. How We Built It Baymax has two user-facing surfaces: ASI:One for natural-language interaction and approvals A live Flask dashboard for real-time monitoring and visualization Both are powered by the same Fetch.ai agent network and synchronized through Redis. Core Stack Agent Network Negotiation Flow Challenges We Ran Into ASI:One Echo Loops ASI:One occasionally interpreted our own agent narration as new user intent. We built filtering, cooldowns, and heuristics to prevent agents from responding to themselves. Payment Card Rendering The Fetch payment card depended on very specific metadata fields. Missing metadata caused silent failures with no visible error messages. Python 3.14 Event Loop Changes uAgents still relied on behavior removed in Python 3.14. We had to carefully manage initialization order to ensure a valid event loop existed before agent creation. Long-Running On-Chain Verification Transaction verification could stall agent execution for up to 20 seconds. We moved verification into background threads using asyncio.to_thread(). Accomplishments We're Proud Of Live End-to-End Settlement We successfully demonstrated: Natural-language intent → surge prediction → multi-hospital negotiation → on-chain payment → confirmed transfer Real Predictive Signals Baymax combines: Live weather data Real illness data Current inventory levels to generate structured shortage forecasts before a shortage is declared. Constraint-Aware Negotiation Baymax doesn't simply match one requester to one provider. It can automatically compose split transfers when multiple facilities are required to satisfy demand. Full Decision Traceability Every prediction, ranking decision, transfer proposal, and outcome is captured in Arize Phoenix. Parallel Development The forecasting, vision, dashboard, observability, and agent teams all built independently against a shared Redis schema and integrated successfully. What We Learned The defensible technology isn't the camera. The real value comes from creating a network that can detect, negotiate, and settle across institutional boundaries before a crisis peaks. We also learned that observability is essential for autonomous systems. The ability to trace every decision made by the system transforms Baymax from a coordination tool into a platform that can improve with experience. Finally, we learned that fail-closed design makes live demos possible. Every major dependency has deterministic fallbacks, allowing the system to remain reliable even when external services are unavailable. What's Next Predictive Pre-Positioning Move inventory before shortages occur when confidence in an incoming surge becomes sufficiently high. Disaster Response Coordination Extend the network to support regional responses for mass-casualty incidents and natural disasters. Ambulance & Patient Routing Apply the same negotiation framework to patient transfers and hospital capacity balancing. Blood & Biologics Logistics Support temperature-sensitive and blood-type-constrained transfers. Cross-System Federation Allow independent health systems to participate in a regional mutual-aid network without exposing internal inventory systems. Supplier-Side Agents Bring distributors into the negotiation process so Baymax can choose the globally optimal resolution between purchasing and transfer options. Baymax sits on top of existing hospital workflows. It doesn't replace clinical decision-making—it helps ensure critical supplies arrive where they're needed before shortages impact patient care. ## Built with fetch.ai · uagents · agentverse · asi:one · chat-protocol · payment-protocol · claude · claude-code · anthropic · redis · arize-phoenix · opencv · open-meteo · disease.sh · flask · python
Baymax
A network of hospital AI agents that detect supply shortfalls and autonomously negotiate and settle inter-facility transfers — before anyone runs out.
A supply manager states an intent in plain English through ASI:One — "Hospital A is short on IV fluids" — and the network takes it from there: it broadcasts the need, collects constrained offers from facilities with surplus, ranks them with Claude, composes a (possibly split) transfer, and settles it as a real on-chain testnet FET transaction — narrating every step back into the chat.
Built at Cal Hacks for the Fetch.ai "From Intent to Action" challenge. Operational logistics only — what to move, how much, by when. Never clinical guidance.
The problem
Hospitals run lean on consumable supplies and absorb uneven demand shocks. One facility runs critically short on an item while another a few miles away sits on a surplus of the exact same thing. Inside multi-facility health systems and regional mutual-aid compacts, this imbalance already gets reconciled — but slowly, by phone, and only if someone catches it in time.
The perception problem (counting what's on the shelf) is a solved commodity. The hard, unsolved problem is coordination across organizational boundaries: detecting the imbalance, matching surplus to shortfall under real constraints, and settling the transfer — autonomously, before the shortage becomes a crisis. That's a multi-agent systems problem, and it's exactly what Fetch.ai's agent mesh and Claude's reasoning make possible.
What it does
Baymax runs one agent per hospital. Each agent knows its live stock (from edge vision) and its forecast demand (from weather and illness signals). The end-to-end chain:
- Shortfall detected — falling stock converges with rising forecast demand.
- The front agent broadcasts a request to the network over uAgents messaging.
- Surplus facilities answer with constrained offers — quantity available, distance/ETA, expiry, urgency.
- Claude ranks the offers and composes a resolution. When no single facility covers the need, it splits the order (e.g. 150 units from the near hospital + 50 from the far one) or trades ETA against expiry, and re-plans on partial rejections.
- The transfer settles as a real transaction via the Fetch Payment Protocol on Dorado testnet —
RequestPayment → CommitPayment → CompletePayment— with the payment card surfacing right in the ASI:One chat for the user to sign. - Everything is shown live — a Redis-backed dashboard renders inventory, the shortfall alert, and the negotiation resolving in real time.
The moment that proves it's real: the negotiation handles a constraint — a partial offer plus a re-plan into a split transfer — and then settles an actual on-chain payment. That's what separates this from scripted message-passing.
Why this is hard
Vision-based inventory monitoring and demand forecasting are rising but those platforms are single-tenant by design: each customer's data is walled off.
Baymax is a different layer entirely: coordination across the wall. A perception platform could sit underneath Baymax as its camera layer — it's a component, that extends and automates. The hard problem is agent-to-agent negotiation and settlement across organizational boundaries, a multi-agent systems problem, not a computer-vision one.
Tools and technologies
| Layer | What we used |
|---|---|
| Agent mesh, chat, settlement | Fetch.ai uAgents + Chat Protocol (v0.3.0) + Payment Protocol (v0.1.0), registered on Agentverse, reachable in ASI:One |
| Reasoning + offer ranking | Claude Sonnet 4.6 via the Anthropic API — multi-constraint offer ranking and natural-language narration; entire codebase built with Claude Code |
| Edge inventory (vision) | MacBook/Pi camera → Claude Vision counts saline units across a green-straw divider, writing qty/surplus straight to Redis |
| State + pub/sub | Redis Stack — inventory, surplus, forecast, transfer audit stream, live event channels |
| Forecast inputs | Open-Meteo weather agent + a CDC/WHO illness signal agent, both writing to forecast:{region} in Redis |
| Observability | Arize Phoenix traces the full decision chain: inventory → forecast → reasoning → transfer → outcome |
| Human-in-the-loop | iMessage approval pipeline with tappable Accept/Reject links via Messages.app (AppleScript) |
| Dashboard | Flask UI auto-refreshing every 3s from Redis; SSE stream for live narration |
Architecture
The agent network
Three Fetch.ai uAgents run the negotiation:
| Agent | Facility | Role |
|---|---|---|
baymax_front | Hospital A | Requester + ASI:One surface. Carries the Chat and Payment protocols; detects the shortfall, broadcasts the request, ranks offers with Claude, composes the transfer, settles it, narrates back. |
baymax_hospital_b | Hospital B | Surplus facility — responds with constrained offers, accepts/rejects transfer legs. |
baymax_hospital_c | Hospital C | Same. |
The negotiation state machine
shortfall_detected → requesting → collecting_offers → evaluating
→ (re_planning if no single offer covers the need) → proposing → settling → confirmed
How the layers connect
Two surfaces, one engine. ASI:One is the Fetch-qualifying conversational surface; the live dashboard is the visual story. Both are driven by the same agents and the same Redis state bus — the integration seam that let each track build in parallel without coupling.
ASI:One chat ──► front agent (uAgents)
│ ▲
broadcast │ │ narration
▼ │
hospital B & C agents
│
Redis ──► Dashboard (Flask)
│
Dorado testnet (Fetch Payment Protocol)

The wire contract is frozen. protocol.py is the single source of truth for every cross-agent message model and the negotiation state machine. The official Fetch Chat/Payment protocol classes are re-exported unchanged — ASI:One matches by schema digest, so a local redefinition would be an incompatible protocol. No module ever redefines these.
Every live dependency has a fail-closed fallback. Redis, the camera, and the chain are each behind a seam in interfaces.py with a deterministic mock. The system is testnet-only by construction: mainnet is refused at startup; payment verification is pinned to fetchai_stable_testnet.
How Claude is used
Claude does two jobs:
Offer ranking. When surplus offers arrive, Claude weighs quantity, distance, expiry date, and urgency against the shortfall. It selects a resolution — single-source if one facility covers the need, or a split transfer (e.g. 150 + 50) when none can alone. The ranking seam in interfaces.py sits behind a deterministic mock for offline testing.
Shelf vision. The camera pipeline sends a JPEG of the supply shelf to Claude Vision, which counts units per hospital across a colored divider. The count writes directly into Redis as qty and surplus, feeding the same inventory the agents read for negotiation.
The intent parser (front_agent.parse_intent) is currently a deterministic keyword/regex parser. A commented ASI:One-LLM seam sits behind the same signature, ready to swap in.
Repository layout
| Path | What it is |
|---|---|
agent-communication-layer/ | The Fetch agent mesh — negotiation core, front/ASI:One agent, Payment Protocol settlement, Mailbox runners |
redis/ | The Redis integration seam — schema, inventory/forecast/alerts/transfers, pub/sub |
fetch/ | Forecast input agents (weather, illness) + the iMessage human-approval pipeline |
hardware/camera connection/ | Claude Vision shelf-counting → Redis |
arize/ | Arize Phoenix decision-chain tracing |
ui/ | Flask dashboard — live pipeline view, SSE narration stream, bureau subprocess management |
baymax_PRD_v2.md | The full product spec |
Quickstart — run the negotiation locally
cd agent-communication-layer
python -m venv .venv && source .venv/bin/activate # Python 3.12+
pip install -r requirements.txt
# 3-agent negotiation in one process; self-exits when done.
STOCKPILE_EXIT_WHEN_DONE=1 python stockpile_agents.py
Pick the scenario with STOCKPILE_ITEM:
STOCKPILE_ITEM | Demonstrates |
|---|---|
"IV fluids" (default) | Split across two facilities (150 + 50 units) |
"saline" | Full cover by a single facility |
"sutures" | No offer — graceful escalation to manual procurement |
Live Redis (optional)
# bring up Redis Stack
docker compose -f redis/docker-compose.redis.yml up -d
# seed inventory/surplus/forecast for all three hospitals
(cd redis/src && REDIS_URL=redis://localhost:6379 \
../../agent-communication-layer/.venv/bin/python seed_demo_data.py)
# run negotiation against live Redis
STOCKPILE_REDIS=1 STOCKPILE_ITEM="IV fluids" STOCKPILE_NEED=200 \
STOCKPILE_EXIT_WHEN_DONE=1 python agent-communication-layer/stockpile_agents.py
Dashboard
python ui/app.py
open http://localhost:5001
Live ASI:One + Agentverse (Mailbox mode)
Run each agent in its own terminal, then connect each to a Mailbox from its Agentverse Inspector URL:
./.venv/bin/python run_hospital_b.py
./.venv/bin/python run_hospital_c.py
./.venv/bin/python run_front.py # Hospital A — ASI:One chat + payment entrypoint
Key environment variables
| Var | Effect |
|---|---|
STOCKPILE_ITEM | Scenario: "IV fluids" (split, default) / "saline" (full cover) / "sutures" (no offer) |
STOCKPILE_EXIT_WHEN_DONE | Self-exit when negotiation terminates |
STOCKPILE_REDIS | 1 → read live Redis; fallback to mock on any failure |
REDIS_URL | Redis endpoint (default redis://localhost:6379) |
ANTHROPIC_API_KEY | Required for Claude Vision (camera pipeline) and offer ranking |
PAYMENT_VERIFY_ONCHAIN | false skips cosmpy tx query — dev/spike only |
STOCKPILE_OFFER_TIMEOUT | Seconds to wait for offers before evaluating (Bureau ~4s; Mailbox 30s+) |
Secrets (.env, private_keys.json) and .venv/ are gitignored.
What we proved works
- Full live run on ASI:One + Dorado testnet: natural-language intent → 3-hospital negotiation → split transfer → in-chat TestFET payment → on-chain settlement → confirmed. On-chain tx
912BB2030A5F14467F434D4CDB0F1DDE23EE6E72E19B9F778998D17A5046557F. - The negotiation genuinely handles constraints — partial offers trigger a re-plan into a real split, not a canned hand-off.
- A clean Redis seam let agents, vision, forecasting, dashboard, and observability build in parallel without coupling.
- The wired path (chat → negotiate → settle → pay) is reproducible offline with deterministic harnesses.
What's next
Near-term extensions:
- Ambulance and patient-acuity routing — extend the same agent mesh to coordinate patient transfers when a facility hits capacity, ranked by acuity, ETA, and receiving-unit availability.
- Doctor-to-agent interface — clinicians state needs in natural language directly from the EHR; the agent layer translates intent into a negotiated transfer without touching a procurement portal.
- Predictive restocking — run the shortfall detector ahead of the crisis: ML demand forecasts (illness curves, seasonal peaks, scheduled procedures) trigger pre-emptive transfers before stock hits the safety threshold.
- Expiry-driven redistribution — agents flag near-expiry surplus and autonomously propose reallocation to high-demand facilities, reducing waste while cutting stockouts.
Scale and federation:
- Live federation across health system operators — extend the wire protocol to cross organizational boundaries, letting independent health systems opt into a regional mutual-aid mesh without sharing internal inventory data directly.
- Supplier-side agents — add distributor agents that quote replenishment offers alongside inter-facility transfers, so the ranker picks the globally cheapest resolution (move existing stock vs. order new).
- Payment Protocol at production scale — migrate from TestFET to mainnet with multi-sig approval gates and audit trails that satisfy procurement compliance.
Broader platform:
- Blood and biologics routing — time-critical, temperature-sensitive, blood-type-constrained transfers are a harder version of the same problem; the constraint model extends directly.
- Disaster-response coordination — broadcast a regional shortfall across the mesh when a mass-casualty event hits; each hospital agent bids available surge capacity in real time.
- ERP / procurement integration — write settled transfers back to SAP/Oracle as confirmed purchase orders, closing the loop from autonomous negotiation to the ledger of record.
Baymax sits on top of existing transfer workflows and hands off — it never replaces them, and it never makes a clinical call.
fetch.ai · uagents · agentverse · asi:one · chat-protocol · payment-protocol · claude · claude-code · anthropic · redis · arize-phoenix · opencv · open-meteo · flask · python
Analysis
View
Metric
- 19
- 14
- 11
- 9
- 8
- 5
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- AnthropicIn code
- FastAPIIn code
- HTMLIn code
- PythonIn code
- RedisIn code
- JavaScriptClaimed
5 of 6 appear in the indexed code. 1 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
- Claude CodeConfig · Commits
- CursorCommits
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
656 KB
Source files
113
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
apollo-ullah/Baymax
174 files · 16.4 MB · @ 6000ef8
Structure
Interface
3 files · 2%Screens, components and styles rendered to the user.
Application logic
96 files · 55%Domain rules, services and shared utilities.
+5 more
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- Python68%
- Markdown19%
- HTML10%
- Shell3%
- YAML0%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
agent-communication-layer/requirements.txt
pypi · 10- anthropic
- cosmpy
- fastapi
- httpx
- opencv-python
- python-dotenv
- redis
- uagents
- uagents-core
- uvicorn[standard]
fetch/agents/requirements.txt
pypi · 7- anthropic
- fastapi
- httpx
- python-dotenv
- redis
- uagents
- uvicorn[standard]
arize/requirements.txt
pypi · 5- arize-phoenix
- openinference-instrumentation
- opentelemetry-exporter-otlp-proto-http
- opentelemetry-sdk
- python-dotenv
hardware/requirements.txt
pypi · 4- anthropic
- opencv-python
- python-dotenv
- redis
redis/requirements.txt
pypi · 4- numpy
- python-dotenv
- redis
- sentence-transformers
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.