med-safety-gym

Train AI agents for safe medical reasoning using reinforcement learning.

Updated Feb 12, 2026
One-click install
npx skills add https://github.com/surfiniaburger/med-safety-gym-v2 --skill med-safety-gym
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: med-safety-gym
Source: https://github.com/surfiniaburger/med-safety-gym-v2/tree/main
Command: npx skills add https://github.com/surfiniaburger/med-safety-gym-v2 --skill med-safety-gym

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires openenv-core>=0.2.0, pydantic>=2.0.0, fastapi>=0.109.1, uvicorn[standard]>=0.24.0, requests>=2.31.0, wsproto==1.0.0, gunicorn==22.0.0, datasets, starlette>=0.36.3, idna>=3.7, pydantic-settings>=2.0.0, sqlalchemy>=2.0.0, psycopg2-binary>=2.9.9, numpy>=1.26.0, PyGithub>=2.0.0, edge-tts>=7.2.7, aiofiles>=25.1.0, mcp>=1.0.0, fastmcp==3.0.0b2, python-telegram-bot>=21.0.0, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill trains AI agents to provide safe and reliable medical advice by strictly adhering to provided clinical context and avoiding hallucinations.

Core Features & Use Cases

  • Contextual Grounding: Ensures AI answers are based only on provided clinical data.
  • Safety Enforcement: Trains AI to refuse answering when context is insufficient or conflicting.
  • Verifiable Reasoning: Requires AI to cite evidence for its answers, enabling auditability.
  • Use Case: Training an LLM to act as a safe medical assistant that can answer patient questions based on their medical records without inventing facts.

Quick Start

Use the med-safety-gym skill to evaluate your AI agent's response to a medical question.

Frequently Asked Questions about med-safety-gym

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I train an AI agent for safe medical reasoning using reinforcement learning?

LLM evaluation for medical AI is done by enforcing contextual grounding, ensuring answers are based only on provided clinical data, and requiring the AI to cite evidence in a structured XML format (with proof and answer tags) for auditability.

Can I use this to stop my medical AI from hallucinating patient records?

Yes, you can stop medical AI from hallucinating by applying a safety enforcement mechanism that trains the AI to refuse answering when clinical context is insufficient or conflicting, rewarding correct abstention rather than inventing facts.

What is the best way to evaluate an LLM's response to a medical question?

Evaluating an LLM's response to a medical question is best done by checking its verifiable reasoning chain, which requires the AI to cite evidence from the provided clinical context using a structured XML output format for strict adherence and auditability.

Does this reinforcement learning framework penalize AI hallucinations and reward abstention?

Yes, the reinforcement learning framework penalizes hallucinations and rewards correct abstention from answering when information is insufficient or conflicting, ensuring the AI acts as a safe medical assistant.

Do I need FastAPI and Pydantic to run the med-safety-gym skill?

Yes, you need FastAPI, Pydantic, and a Python environment with dependencies like openenv-core and uvicorn to run the framework and evaluate your AI agent's medical reasoning responses.