Skip to main content

AnestheSim

Gymnasium environments for reinforcement learning in automated anesthesia drug dosing

Python 3.10+ License: MIT Tests PyPI version


Three Gymnasium-compatible RL environments for automated anesthesia drug dosing: propofol infusion control via the Marsh three-compartment pharmacokinetic model with Hill pharmacodynamic BIS prediction, remifentanil effect-site concentration targeting via the Minto model, and combined propofol-remifentanil anesthesia management using the Greco synergistic interaction surface. Includes configurable difficulty tiers with patient variability and surgical stimulation events, heuristic TCI (Target-Controlled Infusion) clinical baselines, PPO RL agents, and a benchmark suite across three difficulty levels. 109 tests, MIT licensed.

Installation

pip install anesthesim              # Core (numpy, scipy, gymnasium)
pip install anesthesim[train]       # + SB3, PyTorch for RL training
pip install anesthesim[all]         # Everything

Development install:

git clone https://github.com/HassDhia/anesthesim.git
cd anesthesim
pip install -e ".[all]"

Quick Start

import gymnasium as gym
import anesthesim

env = gym.make("anesthesim/PropofolControl-v0")
obs, info = env.reset(seed=42)
for _ in range(100):
    action = env.action_space.sample()
    obs, reward, terminated, truncated, info = env.step(action)
    if terminated or truncated:
        obs, info = env.reset()
env.close()

Environments

Environment Task Observation Action Key Challenge
PropofolControl-v0 BIS-guided propofol infusion Box(6): Cp, Ce, BIS, error, rate, time Box(1): rate [0,200] mcg/kg/min PK/PD delay, surgical stimulation
RemifentanilDosing-v0 Effect-site concentration targeting Box(6): Cp, Ce, target, error, rate, time Box(1): rate [0,0.5] mcg/kg/min Rapid onset/offset, changing targets
CombinedAnesthesia-v0 Multi-drug BIS control Box(8): 2x Cp, 2x Ce, BIS, error, 2x rate Box(2): propofol + remifentanil rates Drug synergy exploitation

Architecture

AnestheSim implements established pharmacokinetic/pharmacodynamic models:

  • Marsh PK Model (Marsh et al., 1991): Three-compartment model for propofol distribution
  • Minto PK Model (Minto et al., 1997): Three-compartment model for remifentanil with effect-site
  • Hill PD Model (Schnider et al., 1999): Sigmoid Emax model mapping propofol Ce to BIS
  • Greco Interaction Model (Bouillon et al., 2004): Response surface for propofol-remifentanil synergy

Paper

The accompanying paper is available at:

Citation

If you use anesthesim in your research, please cite:

@software{dhia2026anesthesim,
  author = {Dhia, Hass},
  title = {AnestheSim: Gymnasium Environments for Reinforcement Learning in Automated Anesthesia Drug Dosing},
  year = {2026},
  publisher = {Smart Technology Investments Research Institute},
  url = {https://github.com/HassDhia/anesthesim}
}

License

MIT License. See LICENSE for details.

Contact

Hass Dhia - Smart Technology Investments Research Institute

Metadata

Release files for anesthesim 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anesthesim 0.1.0
File Size Uploaded Provenance
anesthesim-0.1.0.tar.gz 26.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for anesthesim 0.1.0
File Interpreter ABI Platform
anesthesim-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 52.0 kB

Release files / anesthesim-0.1.0.tar.gz

Download URL anesthesim-0.1.0.tar.gz
Size 26.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c6ab45e340cb8075523ed1a703c7d2b9a985b6c1a0ffda9773c74a4e461388a6
BLAKE2b-256 checksum
How to use checksums
94cdf7a5a7fdd63d6dc9f45f247adab5c112cc00ee3bfa8c5c5f812830d0bcce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.6

Release files / anesthesim-0.1.0-py3-none-any.whl

Download URL anesthesim-0.1.0-py3-none-any.whl
Size 25.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bef8dcacc83a553791f9a1d9c181b4a3e5351726d8580d60a3a4ca811f9903da
BLAKE2b-256 checksum
How to use checksums
5d7324d1115dac66c8aec6a25fa3aec428b62b0ca5a2770d1ab185eee283bf68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.6

Security for anesthesim 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page