AgentPlay
Build environments. Connect any AI. Measure what it does.
A model-agnostic simulation and benchmarking platform that allows developers to build environments, connect AI agents, run experiments, and evaluate their intelligence, strategies, and behaviour.
MIT-licensed and written in Python. Any model can play (hosted, local or your own program), every run is logged and replayable, and results come with ratings and confidence intervals.
Status: released on PyPI as agentplaykit. Docs: https://agentplay.itejas.dev. The specs in specs/ are the source of truth; every requirement has a test.
Install
Python 3.8 or newer. Plain pip works:
pip install agentplaykit
pip install -e ".[dev]" # from a clone, for development
Try it
pip install agentplaykit
agentplaykit play # built-in demo, no API key needed
agentplaykit play examples/guess/scenario.yaml # a custom world + agent from plain .py files
agentplaykit play examples/tic-tac-toe-chat/scenario.yaml # two agents play tic-tac-toe and chat
agentplaykit check examples/guess/scenario.yaml # validate without running
agentplaykit view runs/tic-tac-toe-demo-7.jsonl # replay a run in your browser
agentplaykit play examples/tic-tac-toe-chat/scenario.yaml --live # watch it live
agentplaykit env list # available worlds
agentplaykit doctor # check your setup
Every move, message and cost lands in a JSONL log under runs/.
A scenario is one YAML file; swap an agent by changing its use line:
agentplay: 1
name: tic-tac-toe-demo
seed: 7
world: {use: tic-tac-toe}
agents:
- {id: x, use: scripted/minimax}
- {id: o, use: scripted/random}
A new world (examples/guess/guess_world.py) is under 50 lines and a new agent (bisect_agent.py) under 30, with no framework changes.
Build your own
agentplaykit new world auction # a working world, scenario and test to start from
agentplaykit test auction/auction_world.py --sloppy # how it copes with small-model mistakes
World helpers (TurnBased, TextMoves, ChoiceMoves) make most worlds a few dozen lines, and wrappers add memory, instructions or format hints to any agent with wrap: [memory, format_hints].
Example: two AI models debate
examples/debate has qwen2.5 and llama3.2 arguing "I'm better than you", with the models on a free Google Colab GPU and the debate watched live in your browser. The step-by-step guide and the Colab notebook cover both setups: models on Colab with AgentPlay on your computer, or everything inside Colab.
Use real AI models
Any model can play, hosted or local. Change the agent's use line:
use |
Connects to |
|---|---|
openai, openrouter, groq, deepseek, gemini, mistral, together |
That hosted service; only model is needed, the key comes from its usual variable (OPENROUTER_API_KEY, ...) |
ollama |
A local Ollama server: free, no key |
huggingface |
Open models on the Hugging Face Hub through Inference Providers (key: HF_TOKEN) |
transformers |
Hugging Face models running on your own CPU or GPU, no server (pip install "agentplaykit[hf]" plus PyTorch) |
chat_api |
Any other chat API in the OpenAI-compatible format (DigitalOcean, Cloudflare AI Gateway, LM Studio, vLLM, llama.cpp, proxies) via base_url |
anthropic |
Claude via the Anthropic SDK (pip install "agentplaykit[anthropic]") |
command |
Any program, in any language, reading and writing JSON lines |
http |
Any agent behind a URL |
mcp |
A tool on an MCP server (pip install "agentplaykit[mcp]", Python 3.10+) |
- {id: x, use: ollama, config: {model: "llama3.2"}} # local, free
- {id: y, use: openrouter, config: {model: "<provider>/<model>"}} # key from OPENROUTER_API_KEY
Keys come from environment variables, never from the scenario.
Every call's tokens and cost are logged; runs stop at max_cost_usd (default $1). Set price
per model for exact costs (openrouter reports its own). See examples/tic-tac-toe-llm/scenario.yaml and examples/command-agent/.
Score and compare
Add evaluators to a scenario; they read only the finished log, so agents can never touch them:
evaluators:
- {use: outcome, config: {agent: x}} # did x win?
- {use: judge, config: {rubric: "Did x explain its moves?", agent: {use: openrouter, config: {...}}}}
Run many seeds and get a summary (pass rate, steps, cost, spread):
agentplaykit play examples/treasure/scenario.yaml --runs 20
Rank agents against each other: a tournament plays every pairing on both sides, and a report gives a leaderboard with ratings, ranges, costs and errors:
agentplaykit play examples/arena/scenario.yaml # tournament + report
agentplaykit report runs/ # a report from any logs
Give an agent a real task in a locked-down container (no network, non-root, caps), checked afterwards by commands it never sees (needs Docker):
agentplaykit play examples/hello-sandbox/scenario.yaml
Check your own world or agent against the specs before sharing it:
agentplaykit test my_world.py
agentplaykit test my_agent.py --world tic-tac-toe
Vision and roadmap
AgentPlay is built around four pillars: build environments, connect AI agents, run experiments and evaluate intelligence, strategies and behaviour, all model-agnostic.
| Pillar | Available now | Next |
|---|---|---|
| Environments | World interface and helpers, agentplaykit new, plugins, test kit with sloppy models; tic-tac-toe, rock-paper-scissors, debate, negotiation, sandbox (Docker) |
No-code world templates; reuse Gymnasium, PettingZoo and OpenSpiel environments |
| Agents | Any OpenAI-compatible API, 9 presets, Anthropic, Hugging Face (hosted and local), any program; wrappers for memory, instructions and format hints | Images for vision models; adapters for agent frameworks |
| Experiments | Seeds, --runs, tournaments, budgets, live view, replays |
Experiment sweeps, parallel and resumable runs (v0.10) |
| Evaluation | Outcomes, pass rates, Bradley–Terry ratings, judge behaviour tags | Benchmark suites (v0.11); behaviour and strategy metrics (v0.12) |
The full roadmap is on the docs site.
Develop
python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
pytest
(uv works too: uv venv && uv pip install -e ".[dev]".)
See CONTRIBUTING.md. Licensed under MIT.
Metadata
Release files for agentplaykit 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agentplaykit-0.9.0.tar.gz | 312.7 kB | With provenance | Details for agentplaykit-0.9.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentplaykit-0.9.0-py3-none-any.whl | Python 3 | none | any | Details for agentplaykit-0.9.0-py3-none-any.whl |
Total release size: 455.2 kB
Release files / agentplaykit-0.9.0.tar.gz
| Download URL | agentplaykit-0.9.0.tar.gz |
|---|---|
| Size | 312.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b11a6f421c6ae8ae8a618b9006e88aaf121575d1eb21049728699c33262a3daa
|
|
BLAKE2b-256 checksum How to use checksums |
445699f8056c0a561b95c65e029246e11253a8e07ad383a7d780663d8d0d8018
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / agentplaykit-0.9.0-py3-none-any.whl
| Download URL | agentplaykit-0.9.0-py3-none-any.whl |
|---|---|
| Size | 142.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3c825e2bd6358d25105469d9ebefe09d3c44638356f2298108ee88ecfa5ac58d
|
|
BLAKE2b-256 checksum How to use checksums |
88322fe916c9df2605a670da86525a5de9bb8b5ab0da29b67d5014dc6d7344c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logSecurity for agentplaykit 0.9.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for agentplaykit-0.9.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logA 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.