Skip to main content

AgentPlay

An MIT-licensed Python framework for putting AI agents into worlds, letting them act and talk, and scoring and logging what happens.

Status: v0.1.0 release candidate. 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            # once released
pip install -e ".[dev]"             # from a clone, for development

Try it

pip install -e .                                   # from a clone (PyPI release pending)
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/ox-chat/scenario.yaml   # two agents play OX and chat between moves
agentplaykit check examples/guess/scenario.yaml    # validate without running
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: ox-demo
seed: 7
world: {use: ox}
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.

Use real AI models

Any model can play, hosted or local. Change the agent's use line:

use Connects to
openai_compat Any OpenAI-compatible API: OpenAI, OpenRouter, and local servers (Ollama, LM Studio, vLLM, llama.cpp)
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: openai_compat
  config: {base_url: "http://localhost:11434/v1", model: "llama3.2"}   # local Ollama, free

Keys come from environment variables (api_key_env: OPENROUTER_API_KEY), 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. See examples/ox-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: openai_compat, config: {...}}}}

Run many seeds and get a summary (pass rate, steps, cost, spread):

agentplaykit play examples/treasure/scenario.yaml --runs 20

Check your own world or agent against the specs before sharing it:

agentplaykit test my_world.py
agentplaykit test my_agent.py --world ox

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.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 agentplaykit 0.1.0
File Size Uploaded Provenance Actions
agentplaykit-0.1.0.tar.gz 133.7 kB With provenance Details for agentplaykit-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 202.6 kB

Release files / agentplaykit-0.1.0.tar.gz

Download URL agentplaykit-0.1.0.tar.gz
Size 133.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e388eb0b00235e087830435e9e74124fe1c822f160722278656166bcee4d7269
BLAKE2b-256 checksum
How to use checksums
d0c95e4dcf4bfaeda17d747649f6eb9723b186b32df2d48a444511df1bde5165
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 Nov 30, 2026.

Transparency log

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

Download URL agentplaykit-0.1.0-py3-none-any.whl
Size 68.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06f89fd2d9148843431d9a8fa243ed0ab1e5b6be01338f8198fae4a24ed80aea
BLAKE2b-256 checksum
How to use checksums
1a8979e388b80fbf0c7bbca09f3f7c064074219991f54f2b6004b523cff7b784
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 Nov 30, 2026.

Transparency log

Security for agentplaykit 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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agentplaykit-0.1.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 Nov 30, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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