--- title: PharmaAgent emoji: 💊 colorFrom: blue colorTo: green sdk: docker pinned: false --- # 🏥 PharmaAgent — Clinical Decision RL Environment An OpenMV-compatible reinforcement learning environment where an agent acts as an **AI clinical pharmacist**, navigating a multi-step patient treatment pipeline powered by real DrugBank data. ## What the Agent Does Given a patient case (symptoms + existing medications), the agent must: | Step | Action | Reward | |------|--------|--------| | 1 | **Diagnose** — identify the condition from symptoms | 0–0.30 | | 2 | **Select drugs** — build a safe treatment regimen | 0.05–0.20 per drug | | 3 | **Check DDI** — verify drug-drug interactions | 0.05–0.30 | | 4 | **Finalize** — submit the complete regimen | 0–0.30 | **Total possible reward per episode: 1.5 (normalized to 0–1)** ## Why This Is Different - All scoring is grounded in **real DrugBank data** (19,842 drugs, 500k interaction pairs) — no hardcoded opinions - Patient cases are **generated dynamically** from the database — the agent cannot memorize them - The LLM is called **only once per episode**, at the end, purely to format a human-readable summary — it has zero influence on any reward - Penalizes dangerous drug combinations using DrugBank's own severity classifications ## API Endpoints | Method | Path | Description | |--------|------|-------------| | POST | `/reset` | Start new episode | | POST | `/step?session_id=X` | Take an action | | GET | `/state?session_id=X` | Get session state | | GET | `/health` | Health check | | GET | `/web` | Browser UI for manual testing | ## Stack - FastAPI + SQLite (DrugBank) - Qwen 2.5 72B via HuggingFace Inference Router (agent) - Groq Llama 3.3 70B (summary formatter only)