simpy
Allows your agent to create and analyze discrete event simulations. It's useful for modeling complex systems where events happen at specific times.
What it does
SimPy is a tool for creating simulations of systems that happen over time, like service queues or production lines. It helps understand how these systems work and predict problems.
When to use it
- ✓To simulate waiting times in a bank queue.
- ✓To model the flow of products in a factory.
- ✓To analyze traffic in a computer network.
Example of what to ask your AI
“Simulate a service queue where customers arrive every 5 minutes and service takes an average of 3 minutes.”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
You describe the events that happen (like a customer arriving) and how they interact with available resources (like a service agent). SimPy handles organizing the order and timing of these events.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add K-Dense-AI/scientific-agent-skills --skill simpyOr download just the file:
curl -L https://raw.githubusercontent.com/K-Dense-AI/scientific-agent-skills/main/skills/simpy/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
SimPy
Scope
Use this skill for process-based discrete-event models where active entities yield events and contend for resources: queues, production systems, logistics, networks, service operations, inventory, and other event-driven systems.
SimPy supplies an event scheduler and modeling primitives. It does not choose a scientifically valid conceptual model, input distribution, warm-up, run length, replication count, estimand, or causal interpretation. Treat those as simulation-study methodology, not SimPy API behavior.
Current release and installation
Reviewed 2026-10-01 against current official documentation and the released source:
- Latest stable: SimPy 4.1.2, released on PyPI 2026-05-24; source tag
4.1.2points to commitf4381649. - Package metadata requires Python >=3.8 and classifies CPython 3.8-3.14 plus PyPy. SimPy has no runtime dependencies.
- 4.1.2 adds Python 3.13/3.14 support and modern-interpreter test fixes.
- Upstream and this skill are MIT-licensed.
Create a reproducible environment:
uv venv --python 3.13
source .venv/bin/activate
uv pip install "simpy==4.1.2"
python -c "import importlib.metadata; print(importlib.metadata.version('simpy'))"
Do not silently substitute the latest documentation build: it may describe an
unreleased development revision. Use the versioned 4.1.2 links in
references/sources.md.
Model workflow
- Define purpose and estimands. State the decision/question, system boundary, entities, resources, state, outputs, time units, and terminating event or steady-state target.
- Write a conceptual model first. Record assumptions, distributions, routing, priorities, initial conditions, and omitted mechanisms.
- Implement generators. A SimPy process is an event-yielding Python generator.
Register the generator object with
env.process(...). - Bound execution. Give every production run explicit time, entity, event, and
replication caps. Never call
env.run()on a model containing an endless process. A time horizon alone cannot stop an endlessyield env.timeout(0)loop: events keep running at the same simulation time. Add an event-count or no-time-progress guard, and wait on state-change events instead of zero-delay busy polling. - Separate random streams. Use local RNG instances for logically distinct stochastic sources; retain a seed manifest.
- Instrument deliberately. Observe state after the transition of interest, close time-weighted intervals at the horizon, and test that monitoring does not alter event order.
- Verify and validate. Test deterministic edge cases, conservation identities, traces, queue discipline, and analytical benchmarks; compare against system or expert evidence for the stated purpose.
- Run independent replications. Make intervals from replication-level estimates, not correlated entities within one run.
- Report limitations. Include initialization, unfinished entities, run length, seeds/streams, precision, sensitivity, and validation evidence. Never convert simulation association into a causal claim.
Read references/simulation-methodology.md before making inferential claims.
Minimal bounded model
import random
import simpy
HORIZON = 480.0
arrival_rng = random.Random(101)
service_rng = random.Random(202)
env = simpy.Environment()
server = simpy.Resource(env, capacity=2)
completed = []
def customer(arrival):
with server.request() as request:
yield request
wait = env.now - arrival
yield env.timeout(service_rng.expovariate(1 / 6.0))
completed.append((env.now, wait))
def arrivals():
for _ in range(10_000): # Entity cap.
delay = arrival_rng.expovariate(1 / 4.0)
if env.now + delay >= HORIZON:
return
yield env.timeout(delay)
env.process(customer(env.now))
env.process(arrivals())
env.run(until=HORIZON)
The numeric horizon is half-open: normal events scheduled exactly at 480.0 are
not processed. Report unfinished entities rather than silently treating them as
completed observations.
Core semantics
Environment and deterministic ordering
Environment is single-threaded. The queue is ordered by simulation time, event
priority, then a strictly increasing event ID. Same-time, same-priority events are
therefore processed FIFO in scheduling order. Model processes may represent
…
FAQ
What is a 'process' in SimPy?
A process is a sequence of actions that occur in a simulated system, such as a customer waiting in line and then being served.
How does SimPy know when things happen?
It uses an 'event scheduler' that organizes all future actions and executes them in the correct time order.
Can I simulate things happening at the same time?
Yes, SimPy allows modeling multiple events and interactions that can occur simultaneously, but it processes them one by one in an organized manner.
Details
Original description by the author
Builds, inspects, tests, and analyzes bounded process-based discrete-event simulations with SimPy. Use for event scheduling, resource queues, interrupts, monitoring, independent replications, warm-up, and reproducible output analysis.
Popularity
- GitHub stars
- 51k
- Ranking position
- #1982
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
13c-metabolic-flux
Estimates metabolic fluxes using carbon-13 isotope tracing data. It is useful for analyzing cellular metabolism and biochemical pathways.
K-Dense-AI/scientific-agent-skills
adaptyv
Designs protein characterization experiments using the Adaptyv API. It helps estimate costs, submit sequences, and monitor lab results.
K-Dense-AI/scientific-agent-skills
aeon
Performs machine learning tasks on time series data. It is useful for classifying, forecasting, detecting anomalies, and finding patterns in sequential data.
K-Dense-AI/scientific-agent-skills
alphagenome
Looks up precomputed genomic effects for genetic variants. It provides scores and explanations to understand the impact of variants on the genome.
K-Dense-AI/scientific-agent-skills
Similar skills
dashboard-builder
Helps your agent create useful monitoring dashboards. It turns data into charts that answer important system questions.
affaan-m/ECC
dev-team
Simulates a collaborative development team where different roles respond to a problem together. It's useful for getting multiple perspectives without manually switching agents.
affaan-m/ECC
ecc-council
Has your agent convene a four-voice council for difficult decisions. It's useful when there are multiple good options and debate is needed before choosing.
affaan-m/ECC