Inspiration 4 years as B2B KAM in clinical diagnostics taught me one thing: lab supervisors spend every morning checking spreadsheets to avoid reagent stockouts. When they fail, testing stops and patients wait. Current solutions (Quartzy, Scispot) only alert after stock hits a threshold. Nobody predicts when stock will run out based on test-type demand patterns. The insight that changed everything: TSH demand in Argentine labs spikes 2.5x every autumn (March–May). A lab with 680 units at 147 units/day will run out in 6 days. A threshold alert fires too late. A prediction fires in time. What it does LabOps Agent predicts reagent stockouts before they happen and lets lab staff act directly from Slack — no LIMS login required. Every hour, the agent forecasts demand for each reagent using Prophet. When projected stockout < reorder lead time, it fires a Block Kit alert in #labops-alerts with a Claude-generated explanation of WHY the stockout is predicted. Staff can then:
📊 View forecast — 7-day demand table with 80% confidence intervals
recent alert history from the channel
🛒 Order reagent — modal opens with pre-filled reagent, model-suggested quantity, and supplier dropdown. One click creates the order in Supabase and updates the Canvas inventory. 👤 Assign to team — sends a DM to the selected team member with full alert context
How we built it Backend: FastAPI + Prophet + Supabase. Prophet trains on real demand_history data from the database, with seasonal patterns calibrated to Argentine clinical lab demand (TSH autumn spike 2.5×). Slack layer: Bolt Python with Socket Mode. Three interactive button handlers, two modals, Canvas API with Block Kit fallback, app mention handler for on-demand summaries. MCP Server: Real implementation using the official Anthropic MCP Python SDK (stdio transport). Exposes 4 typed tools: get_inventory, get_forecast, create_order, update_canvas. AI: Claude API (claude-sonnet-4-6, temperature=0) generates natural language explanations. Channel History API surfaces past alerts in the forecast thread. Validation: 26 passing pytest tests across integration, MCP, and prediction layers. Prophet cross-validated with MAPE 11.34% (TSH) and 78.6% 80%-CI coverage — see notebooks/cv_metrics.json. Challenges we ran into
Prophet + Supabase integration: The initial implementation generated purely synthetic data on every call, ignoring the real demand_history table. Fixing this was the most impactful architectural change of the project. Slack Canvas API: Requires Enterprise features not available in the Developer Sandbox. Implemented with graceful Block Kit fallback that provides equivalent UX. search.messages token type: Requires a user token, not a bot token. Documented honestly and fell back to conversations.history with channels:history scope. Socket Mode + async handlers: Slack requires ack() within 3 seconds. All Claude API calls and Canvas updates run after ack() to prevent timeouts.
Accomplishments that we're proud of
Predict before, not alert after — the core differentiator that no existing Slack app for labs implements Real MCP Server using the official SDK, not a REST wrapper with a misleading name Domain intelligence — TSH autumn spike (Mar–May), hemograma stability, ionograma flat demand — patterns a generic bot can't know Honest documentation — every limitation (Canvas fallback, conversations.history vs search.messages) is documented transparently in the repo; demand model calibrated with 414,289 real B2B records (demo inventory/order data remains synthetic, DEMO-badged) 26/26 tests passing on a hackathon timeline
What we learned
MCP Server integration with Bolt Python requires careful separation of the stdio transport layer from the REST API layer np.random.seed(42) in Prophet is the equivalent of temperature=0 for LLMs — essential for reproducible clinical predictions The "predict before, not alert after" framing immediately resonates with lab operations teams — it solves the right problem Graceful degradation is not a compromise — it's a design principle. Every failure mode has a fallback that preserves UX.
What's next for LabOps Agent Phase 1 (months 1–3): 5 pilot laboratories in Argentina, validating real-world stockout reduction against baseline threshold-based alerting, informed by demand-based forecasting research in healthcare inventory management (Gebicki et al., 2014). Phase 2 (months 4–6): Generic model — any lab with consumption history can onboard. Transfer learning for labs without historical data. Phase 3 (months 7–12): LATAM expansion. Integration with major LIMS systems (LabWare, Creliohealth). Multi-language support for Brazil. Every prevented stockout = uninterrupted diagnostic workflow. For TSH: thyroid screening for pregnant women and elderly patients. For hemograma: anemia detection in children. That's the impact.
Built With
- bolt-python
- claude-api-(anthropic)
- docker
- fastapi
- mcp-python-sdk
- postgresql
- prophet-(facebook/meta)
- pytest
- python
- slack-block-kit
- slack-canvas-api
- socket-mode
- supabase
Log in or sign up for Devpost to join the conversation.