Spaces:
Sleeping
Sleeping
| 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) | |