agentplaykit 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. agentplaykit-0.1.0/.github/CODEOWNERS +3 -0
  2. agentplaykit-0.1.0/.github/ISSUE_TEMPLATE/bug.md +10 -0
  3. agentplaykit-0.1.0/.github/ISSUE_TEMPLATE/spec-proposal.md +10 -0
  4. agentplaykit-0.1.0/.github/ISSUE_TEMPLATE/world-request.md +10 -0
  5. agentplaykit-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +10 -0
  6. agentplaykit-0.1.0/.github/workflows/ci.yml +121 -0
  7. agentplaykit-0.1.0/.github/workflows/docs.yml +34 -0
  8. agentplaykit-0.1.0/.github/workflows/release.yml +80 -0
  9. agentplaykit-0.1.0/.gitignore +15 -0
  10. agentplaykit-0.1.0/.pre-commit-config.yaml +19 -0
  11. agentplaykit-0.1.0/CHANGELOG.md +46 -0
  12. agentplaykit-0.1.0/CODE_OF_CONDUCT.md +7 -0
  13. agentplaykit-0.1.0/CONTRIBUTING.md +43 -0
  14. agentplaykit-0.1.0/GOVERNANCE.md +6 -0
  15. agentplaykit-0.1.0/LICENSE +21 -0
  16. agentplaykit-0.1.0/MAINTAINERS.md +10 -0
  17. agentplaykit-0.1.0/PKG-INFO +123 -0
  18. agentplaykit-0.1.0/README.md +83 -0
  19. agentplaykit-0.1.0/SECURITY.md +9 -0
  20. agentplaykit-0.1.0/docs/adr/0000-template.md +7 -0
  21. agentplaykit-0.1.0/docs/adr/0001-name-and-package-name.md +12 -0
  22. agentplaykit-0.1.0/docs/adr/0002-tooling-and-defaults.md +16 -0
  23. agentplaykit-0.1.0/docs/adr/0003-model-neutral.md +15 -0
  24. agentplaykit-0.1.0/docs/adr/0004-no-built-in-prices.md +14 -0
  25. agentplaykit-0.1.0/docs/development-plan.md +302 -0
  26. agentplaykit-0.1.0/docs/guides/cli.md +30 -0
  27. agentplaykit-0.1.0/docs/guides/models.md +69 -0
  28. agentplaykit-0.1.0/docs/guides/run-log.md +32 -0
  29. agentplaykit-0.1.0/docs/guides/scenarios.md +65 -0
  30. agentplaykit-0.1.0/docs/index.md +43 -0
  31. agentplaykit-0.1.0/docs/quickstart.md +80 -0
  32. agentplaykit-0.1.0/docs/release-checklist.md +56 -0
  33. agentplaykit-0.1.0/docs/security-review.md +58 -0
  34. agentplaykit-0.1.0/docs/tutorials/evaluate.md +68 -0
  35. agentplaykit-0.1.0/docs/tutorials/write-a-world.md +60 -0
  36. agentplaykit-0.1.0/docs/tutorials/write-an-agent.md +84 -0
  37. agentplaykit-0.1.0/examples/command-agent/my_agent.py +17 -0
  38. agentplaykit-0.1.0/examples/command-agent/scenario.yaml +12 -0
  39. agentplaykit-0.1.0/examples/guess/bisect_agent.py +20 -0
  40. agentplaykit-0.1.0/examples/guess/guess_world.py +45 -0
  41. agentplaykit-0.1.0/examples/guess/scenario.yaml +9 -0
  42. agentplaykit-0.1.0/examples/ox-chat/scenario.yaml +15 -0
  43. agentplaykit-0.1.0/examples/ox-llm/scenario.yaml +38 -0
  44. agentplaykit-0.1.0/examples/ox_demo.py +18 -0
  45. agentplaykit-0.1.0/examples/treasure/scenario.yaml +13 -0
  46. agentplaykit-0.1.0/examples/treasure/treasure_checker.py +32 -0
  47. agentplaykit-0.1.0/examples/treasure/treasure_world.py +69 -0
  48. agentplaykit-0.1.0/mkdocs.yml +49 -0
  49. agentplaykit-0.1.0/pyproject.toml +84 -0
  50. agentplaykit-0.1.0/scripts/check_boundaries.py +51 -0
  51. agentplaykit-0.1.0/scripts/check_licenses.py +77 -0
  52. agentplaykit-0.1.0/scripts/check_spdx.py +26 -0
  53. agentplaykit-0.1.0/scripts/check_spec_links.py +54 -0
  54. agentplaykit-0.1.0/scripts/mkdocs_hooks.py +46 -0
  55. agentplaykit-0.1.0/specs/SPEC-000-process.md +43 -0
  56. agentplaykit-0.1.0/specs/SPEC-001-environment.md +99 -0
  57. agentplaykit-0.1.0/specs/SPEC-002-agent.md +61 -0
  58. agentplaykit-0.1.0/specs/SPEC-003-run-log.md +66 -0
  59. agentplaykit-0.1.0/specs/SPEC-004-runner.md +65 -0
  60. agentplaykit-0.1.0/specs/SPEC-005-scenario.md +62 -0
  61. agentplaykit-0.1.0/specs/SPEC-006-registry.md +42 -0
  62. agentplaykit-0.1.0/specs/SPEC-007-cli.md +43 -0
  63. agentplaykit-0.1.0/specs/SPEC-008-message-bus.md +42 -0
  64. agentplaykit-0.1.0/specs/SPEC-009-adapters.md +81 -0
  65. agentplaykit-0.1.0/specs/SPEC-010-evaluators.md +44 -0
  66. agentplaykit-0.1.0/specs/SPEC-011-security.md +40 -0
  67. agentplaykit-0.1.0/specs/TEMPLATE.md +28 -0
  68. agentplaykit-0.1.0/specs/schemas/evalresult.schema.json +84 -0
  69. agentplaykit-0.1.0/specs/schemas/runlog.schema.json +572 -0
  70. agentplaykit-0.1.0/specs/schemas/scenario.schema.json +152 -0
  71. agentplaykit-0.1.0/specs/untested.yaml +7 -0
  72. agentplaykit-0.1.0/src/agentplaykit/__init__.py +4 -0
  73. agentplaykit-0.1.0/src/agentplaykit/__main__.py +4 -0
  74. agentplaykit-0.1.0/src/agentplaykit/agents/__init__.py +1 -0
  75. agentplaykit-0.1.0/src/agentplaykit/agents/_http.py +180 -0
  76. agentplaykit-0.1.0/src/agentplaykit/agents/anthropic_agent.py +156 -0
  77. agentplaykit-0.1.0/src/agentplaykit/agents/command.py +144 -0
  78. agentplaykit-0.1.0/src/agentplaykit/agents/config.py +67 -0
  79. agentplaykit-0.1.0/src/agentplaykit/agents/http_agent.py +56 -0
  80. agentplaykit-0.1.0/src/agentplaykit/agents/mcp_agent.py +86 -0
  81. agentplaykit-0.1.0/src/agentplaykit/agents/openai_compat.py +161 -0
  82. agentplaykit-0.1.0/src/agentplaykit/agents/pricing.py +29 -0
  83. agentplaykit-0.1.0/src/agentplaykit/agents/proc.py +55 -0
  84. agentplaykit-0.1.0/src/agentplaykit/agents/prompting.py +124 -0
  85. agentplaykit-0.1.0/src/agentplaykit/agents/scripted.py +82 -0
  86. agentplaykit-0.1.0/src/agentplaykit/cli/__init__.py +1 -0
  87. agentplaykit-0.1.0/src/agentplaykit/cli/main.py +276 -0
  88. agentplaykit-0.1.0/src/agentplaykit/core/__init__.py +44 -0
  89. agentplaykit-0.1.0/src/agentplaykit/core/agent.py +51 -0
  90. agentplaykit-0.1.0/src/agentplaykit/core/bus.py +95 -0
  91. agentplaykit-0.1.0/src/agentplaykit/core/environment.py +111 -0
  92. agentplaykit-0.1.0/src/agentplaykit/core/evaluator.py +111 -0
  93. agentplaykit-0.1.0/src/agentplaykit/core/log.py +122 -0
  94. agentplaykit-0.1.0/src/agentplaykit/core/plain.py +41 -0
  95. agentplaykit-0.1.0/src/agentplaykit/core/runner.py +429 -0
  96. agentplaykit-0.1.0/src/agentplaykit/envs/__init__.py +1 -0
  97. agentplaykit-0.1.0/src/agentplaykit/envs/blank.py +51 -0
  98. agentplaykit-0.1.0/src/agentplaykit/envs/ox.py +67 -0
  99. agentplaykit-0.1.0/src/agentplaykit/envs/rps.py +77 -0
  100. agentplaykit-0.1.0/src/agentplaykit/evals/__init__.py +1 -0
  101. agentplaykit-0.1.0/src/agentplaykit/evals/judge.py +167 -0
  102. agentplaykit-0.1.0/src/agentplaykit/evals/outcome.py +59 -0
  103. agentplaykit-0.1.0/src/agentplaykit/evals/summary.py +136 -0
  104. agentplaykit-0.1.0/src/agentplaykit/py.typed +0 -0
  105. agentplaykit-0.1.0/src/agentplaykit/registry/__init__.py +342 -0
  106. agentplaykit-0.1.0/src/agentplaykit/scenario/__init__.py +496 -0
  107. agentplaykit-0.1.0/src/agentplaykit/scenarios/demo.yaml +8 -0
  108. agentplaykit-0.1.0/src/agentplaykit/schemas/evalresult.schema.json +84 -0
  109. agentplaykit-0.1.0/src/agentplaykit/schemas/runlog.schema.json +572 -0
  110. agentplaykit-0.1.0/src/agentplaykit/schemas/scenario.schema.json +152 -0
  111. agentplaykit-0.1.0/src/agentplaykit/testkit.py +383 -0
  112. agentplaykit-0.1.0/tests/__init__.py +1 -0
  113. agentplaykit-0.1.0/tests/conformance/__init__.py +1 -0
  114. agentplaykit-0.1.0/tests/conformance/conftest.py +30 -0
  115. agentplaykit-0.1.0/tests/conformance/fakes.py +118 -0
  116. agentplaykit-0.1.0/tests/conformance/helpers.py +126 -0
  117. agentplaykit-0.1.0/tests/conformance/plugin_pkg.py +16 -0
  118. agentplaykit-0.1.0/tests/conformance/test_adapters.py +584 -0
  119. agentplaykit-0.1.0/tests/conformance/test_agent.py +115 -0
  120. agentplaykit-0.1.0/tests/conformance/test_cli.py +219 -0
  121. agentplaykit-0.1.0/tests/conformance/test_environment.py +224 -0
  122. agentplaykit-0.1.0/tests/conformance/test_evaluators.py +317 -0
  123. agentplaykit-0.1.0/tests/conformance/test_message_bus.py +173 -0
  124. agentplaykit-0.1.0/tests/conformance/test_registry.py +139 -0
  125. agentplaykit-0.1.0/tests/conformance/test_run_log.py +145 -0
  126. agentplaykit-0.1.0/tests/conformance/test_runner.py +235 -0
  127. agentplaykit-0.1.0/tests/conformance/test_scenario.py +216 -0
  128. agentplaykit-0.1.0/tests/conformance/test_schemas.py +86 -0
  129. agentplaykit-0.1.0/tests/conformance/test_security.py +291 -0
  130. agentplaykit-0.1.0/tests/conformance/test_specs.py +29 -0
  131. agentplaykit-0.1.0/tests/conformance/test_testkit.py +92 -0
  132. agentplaykit-0.1.0/tests/fixtures/providers/README.md +4 -0
  133. agentplaykit-0.1.0/tests/fixtures/providers/anthropic_refusal.json +3 -0
  134. agentplaykit-0.1.0/tests/fixtures/providers/anthropic_text.json +4 -0
  135. agentplaykit-0.1.0/tests/fixtures/providers/anthropic_tool_use.json +7 -0
  136. agentplaykit-0.1.0/tests/fixtures/providers/openai_chat_no_usage.json +3 -0
  137. agentplaykit-0.1.0/tests/fixtures/providers/openai_chat_text.json +4 -0
  138. agentplaykit-0.1.0/tests/fixtures/providers/openai_chat_tool.json +6 -0
  139. agentplaykit-0.1.0/tests/fixtures/sample_run.jsonl +14 -0
  140. agentplaykit-0.1.0/tests/fixtures/sample_scenario.yaml +8 -0
  141. agentplaykit-0.1.0/tests/golden/ox_minimax_vs_random_seed7.jsonl +27 -0
  142. agentplaykit-0.1.0/tests/live/__init__.py +1 -0
  143. agentplaykit-0.1.0/tests/live/test_live_adapters.py +62 -0
  144. agentplaykit-0.1.0/tests/test_smoke.py +11 -0
@@ -0,0 +1,3 @@
1
+ # specs/ always needs a maintainer
2
+ * @thetejasmagade
3
+ /specs/ @thetejasmagade
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: Bug report
3
+ about: Something does not behave as specified
4
+ labels: bug
5
+ ---
6
+ **What happened / what you expected**
7
+
8
+ **Steps to reproduce** (scenario file, seed, command)
9
+
10
+ **Versions** (`agentplaykit --version`, Python, OS)
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: Spec proposal
3
+ about: Propose a behavior or interface change
4
+ labels: spec
5
+ ---
6
+ **Problem**
7
+
8
+ **User-visible behavior wanted**
9
+
10
+ **Affected specs / public interfaces**
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: World request
3
+ about: Suggest a new world
4
+ labels: world-request
5
+ ---
6
+ **World idea and rules**
7
+
8
+ **Players, observations, actions**
9
+
10
+ **How is it scored?**
@@ -0,0 +1,10 @@
1
+ ## What and why
2
+
3
+ ## Spec and tests
4
+ - Spec: <!-- e.g. specs/SPEC-001-environment.md, or "n/a: no behavior change" -->
5
+ - Test IDs: <!-- e.g. ENV-012 -->
6
+
7
+ ## Checklist
8
+ - [ ] Spec change and code change are in separate commits
9
+ - [ ] CI passes; commits are signed off (`git commit -s`)
10
+ - [ ] SPDX header on new files
@@ -0,0 +1,121 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches: [master]
5
+ pull_request:
6
+
7
+ jobs:
8
+ test:
9
+ strategy:
10
+ fail-fast: false
11
+ matrix:
12
+ os: [ubuntu-latest, macos-latest, windows-latest]
13
+ python: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
14
+ runs-on: ${{ matrix.os }}
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: astral-sh/setup-uv@v3
18
+ - run: uv venv --python ${{ matrix.python }}
19
+ - run: uv pip install -e ".[dev]"
20
+ - run: uv run python scripts/check_spdx.py
21
+ - run: uv run python scripts/check_boundaries.py
22
+ - run: uv run ruff check .
23
+ - run: uv run ruff format --check .
24
+ - run: uv run mypy
25
+ - run: uv run pytest --cov
26
+ - run: uv run coverage report --include='*/agentplaykit/core/*' --fail-under=90
27
+
28
+ checks:
29
+ # Spec-link check (PRO-011) and license scan (plan section 6)
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+ - uses: actions/setup-python@v5
34
+ with: { python-version: "3.12" }
35
+ - run: python -m pip install -e ".[dev,anthropic,mcp]"
36
+ - run: python scripts/check_spec_links.py
37
+ - run: python scripts/check_licenses.py anthropic mcp
38
+
39
+ docs:
40
+ runs-on: ubuntu-latest
41
+ steps:
42
+ - uses: actions/checkout@v4
43
+ - uses: actions/setup-python@v5
44
+ with: { python-version: "3.12" }
45
+ - run: python -m pip install -e ".[docs]"
46
+ - run: mkdocs build --strict
47
+
48
+ e2e:
49
+ # v0.1 "done when": a fresh machine goes from pip install to a finished demo in under 2 minutes
50
+ strategy:
51
+ fail-fast: false
52
+ matrix:
53
+ os: [ubuntu-latest, macos-latest, windows-latest]
54
+ runs-on: ${{ matrix.os }}
55
+ defaults:
56
+ run: { shell: bash }
57
+ steps:
58
+ - uses: actions/checkout@v4
59
+ - uses: actions/setup-python@v5
60
+ with: { python-version: "3.12" }
61
+ - run: python -m pip install build && python -m build --wheel
62
+ - name: Fresh virtualenv, install, demo, timed
63
+ run: |
64
+ start=$(date +%s)
65
+ python -m venv "$RUNNER_TEMP/e2e"
66
+ source "$RUNNER_TEMP/e2e/bin/activate" 2>/dev/null || source "$RUNNER_TEMP/e2e/Scripts/activate"
67
+ cd "$RUNNER_TEMP"
68
+ python -m pip install "$GITHUB_WORKSPACE"/dist/*.whl
69
+ agentplaykit play
70
+ elapsed=$(( $(date +%s) - start ))
71
+ echo "install + demo took ${elapsed}s"
72
+ test "$elapsed" -lt 120
73
+
74
+ pip-install:
75
+ # pip must work with no extra tooling (ADR-0002). uv only provides the interpreter:
76
+ # setup-python has no Python 3.8 build for current ubuntu-latest (3.8 is end-of-life).
77
+ strategy:
78
+ fail-fast: false
79
+ matrix:
80
+ python: ["3.8", "3.13"]
81
+ runs-on: ubuntu-latest
82
+ steps:
83
+ - uses: actions/checkout@v4
84
+ - uses: astral-sh/setup-uv@v3
85
+ - run: uv python install ${{ matrix.python }}
86
+ - name: Plain venv and pip install
87
+ run: |
88
+ "$(uv python find ${{ matrix.python }})" -m venv "$RUNNER_TEMP/pipenv"
89
+ echo "$RUNNER_TEMP/pipenv/bin" >> "$GITHUB_PATH"
90
+ - run: python --version && python -m pip --version
91
+ - run: python -m pip install .
92
+ - run: agentplaykit --version
93
+ - name: Demo runs with no API key (v0.1 "done when" criterion)
94
+ run: |
95
+ agentplaykit play
96
+ agentplaykit check examples/guess/scenario.yaml
97
+ agentplaykit doctor
98
+
99
+ extras:
100
+ # Adapter tests with the optional SDKs installed (anthropic, mcp). Still no keys or network.
101
+ runs-on: ubuntu-latest
102
+ steps:
103
+ - uses: actions/checkout@v4
104
+ - uses: actions/setup-python@v5
105
+ with: { python-version: "3.12" }
106
+ - run: python -m pip install -e ".[dev,anthropic,mcp]"
107
+ - run: python -m pytest tests/conformance/test_adapters.py -q
108
+
109
+ dco:
110
+ if: github.event_name == 'pull_request'
111
+ runs-on: ubuntu-latest
112
+ steps:
113
+ - uses: actions/checkout@v4
114
+ with: { fetch-depth: 0 }
115
+ - name: Require Signed-off-by on every commit
116
+ run: |
117
+ bad=0
118
+ for c in $(git rev-list ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}); do
119
+ git show -s --format=%B $c | grep -q '^Signed-off-by: ' || { echo "missing DCO sign-off: $c"; bad=1; }
120
+ done
121
+ exit $bad
@@ -0,0 +1,34 @@
1
+ name: Docs
2
+ on:
3
+ push:
4
+ branches: [master]
5
+ paths: ["docs/**", "specs/**", "examples/**", "mkdocs.yml", "scripts/mkdocs_hooks.py"]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+ pages: write
11
+ id-token: write
12
+
13
+ concurrency: {group: pages, cancel-in-progress: true}
14
+
15
+ jobs:
16
+ build:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: actions/setup-python@v5
21
+ with: { python-version: "3.12" }
22
+ - run: python -m pip install -e ".[docs]"
23
+ - run: mkdocs build --strict -d site
24
+ - uses: actions/upload-pages-artifact@v3
25
+ with: { path: site }
26
+
27
+ deploy:
28
+ # Needs Settings -> Pages -> Source: "GitHub Actions"
29
+ needs: build
30
+ runs-on: ubuntu-latest
31
+ environment: {name: github-pages, url: "${{ steps.deployment.outputs.page_url }}"}
32
+ steps:
33
+ - id: deployment
34
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,80 @@
1
+ name: Release
2
+ # Publishes a tagged version. Start it either way:
3
+ # - push a tag such as v0.1.0 (command line), or create a release with a new v* tag on GitHub
4
+ # (browser or mobile app), which pushes the tag;
5
+ # - Actions -> Release -> Run workflow, choosing the tag under "Use workflow from".
6
+ # Publishing uses PyPI trusted publishing: no API token is stored in this repository
7
+ # (see docs/release-checklist.md). Every step is safe to re-run for the same tag.
8
+ on:
9
+ push:
10
+ tags: ["v*"]
11
+ workflow_dispatch:
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ concurrency:
17
+ group: release-${{ github.ref }}
18
+ cancel-in-progress: false
19
+
20
+ jobs:
21
+ build:
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - name: Must run from a version tag
25
+ run: |
26
+ case "$GITHUB_REF" in
27
+ refs/tags/v*) echo "releasing $GITHUB_REF_NAME" ;;
28
+ *) echo "run this workflow from a v* tag (Use workflow from: Tags), not $GITHUB_REF"; exit 1 ;;
29
+ esac
30
+ - uses: actions/checkout@v4
31
+ - uses: actions/setup-python@v5
32
+ with: { python-version: "3.12" }
33
+ - run: python -m pip install -e ".[dev]" build twine
34
+ - run: python -m pytest -q
35
+ - name: Tag matches the package version
36
+ run: |
37
+ version=$(python -c "import agentplaykit; print(agentplaykit.__version__)")
38
+ test "v$version" = "$GITHUB_REF_NAME" || { echo "tag $GITHUB_REF_NAME != v$version"; exit 1; }
39
+ - run: python -m build
40
+ - run: python -m twine check dist/*
41
+ - uses: actions/upload-artifact@v4
42
+ with: { name: dist, path: dist/ }
43
+
44
+ publish:
45
+ needs: build
46
+ runs-on: ubuntu-latest
47
+ environment: {name: pypi, url: "https://pypi.org/project/agentplaykit/"}
48
+ permissions:
49
+ id-token: write
50
+ steps:
51
+ - uses: actions/download-artifact@v4
52
+ with: { name: dist, path: dist/ }
53
+ - uses: pypa/gh-action-pypi-publish@release/v1
54
+ with:
55
+ skip-existing: true # a re-run for the same version must not fail
56
+
57
+ github-release:
58
+ needs: publish
59
+ runs-on: ubuntu-latest
60
+ permissions:
61
+ contents: write
62
+ steps:
63
+ - uses: actions/checkout@v4
64
+ - uses: actions/download-artifact@v4
65
+ with: { name: dist, path: dist/ }
66
+ - name: Release notes from CHANGELOG.md
67
+ run: |
68
+ version="${GITHUB_REF_NAME#v}"
69
+ awk -v v="$version" '/^## \[/{p = index($0, "[" v "]") > 0; next} p' CHANGELOG.md > notes.md
70
+ test -s notes.md || { echo "no CHANGELOG section for $version"; exit 1; }
71
+ - name: Create the GitHub release, or update one made in the browser
72
+ env: { GH_TOKEN: "${{ github.token }}" }
73
+ run: |
74
+ title="AgentPlay $GITHUB_REF_NAME"
75
+ if gh release view "$GITHUB_REF_NAME" > /dev/null 2>&1; then
76
+ gh release edit "$GITHUB_REF_NAME" --title "$title" --notes-file notes.md
77
+ gh release upload "$GITHUB_REF_NAME" dist/* --clobber
78
+ else
79
+ gh release create "$GITHUB_REF_NAME" dist/* --title "$title" --notes-file notes.md
80
+ fi
@@ -0,0 +1,15 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .venv*/
4
+ .env
5
+ dist/
6
+ build/
7
+ *.egg-info/
8
+ .pytest_cache/
9
+ .mypy_cache/
10
+ .ruff_cache/
11
+ .coverage
12
+ htmlcov/
13
+ site/
14
+ runs/
15
+ docs/specs/
@@ -0,0 +1,19 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.6.9
4
+ hooks:
5
+ - id: ruff
6
+ args: [--fix]
7
+ - id: ruff-format
8
+ - repo: local
9
+ hooks:
10
+ - id: spdx
11
+ name: SPDX headers
12
+ entry: python scripts/check_spdx.py
13
+ language: system
14
+ pass_filenames: false
15
+ - id: boundaries
16
+ name: package boundaries
17
+ entry: python scripts/check_boundaries.py
18
+ language: system
19
+ pass_filenames: false
@@ -0,0 +1,46 @@
1
+ # Changelog
2
+
3
+ Format: [Keep a Changelog](https://keepachangelog.com/). Versioning: [SemVer](https://semver.org/)
4
+ (0.x until the interfaces settle). The scenario schema (`agentplay: 1`) and the run log
5
+ (`log_version: 1`) are versioned separately.
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0] - 2026-11-30
10
+
11
+ First release: the engine for putting AI agents into worlds, letting them act and talk, and
12
+ scoring and logging what happens. Local only; no viewer yet.
13
+
14
+ ### Added
15
+ - **Core** (SPEC-001 to SPEC-004): `Environment` and `Agent` interfaces, a runner for
16
+ sequential and simultaneous worlds, step, time, cost and token limits on by default,
17
+ illegal-move feedback and forfeits, provider errors kept apart from model failures, and a
18
+ JSONL run log with a JSON Schema and a golden-log test.
19
+ - **Scenarios, registry, CLI** (SPEC-005 to SPEC-007): one YAML file per scenario with split
20
+ layout and secret detection; plugins by file, `agentplaykit.yaml`, entry points or built-in
21
+ name; `play`, `check`, `env list`, `test`, `doctor`; every user mistake is one line naming the
22
+ file, the field and the fix.
23
+ - **Messaging** (SPEC-008): public and private messages between agents, ordered, size-limited
24
+ and logged.
25
+ - **Any AI agent** (SPEC-009): `openai_compat` (OpenAI, OpenRouter, Ollama, LM Studio, vLLM,
26
+ llama.cpp), `anthropic` (extra), `command` (any program), `http`, `mcp` (extra) and free
27
+ scripted bots; one shared prompt for fair comparisons; retries with backoff; user-supplied
28
+ prices.
29
+ - **Evaluation** (SPEC-010): evaluators that read only the finished log, the built-in
30
+ `outcome` checker, a `judge` slot where any agent adapter grades a run, and `--runs N`
31
+ summaries that reproduce from their seeds.
32
+ - **Worlds**: `ox`, `rps` (simultaneous), `blank` (template); examples `guess`, `treasure`,
33
+ `ox-chat`, `ox-llm`, `command-agent`.
34
+ - **For plugin authors**: `agentplaykit test my_world.py` runs the spec checks against your code.
35
+ - **Docs**: a site built from `docs/` and `specs/`: quickstart, tutorials, guides, all specs
36
+ and decisions.
37
+
38
+ ### Security
39
+ - M6 review (`docs/security-review.md`): HTTP adapters never follow redirects (a key was
40
+ re-sent to the redirect target), keys are never sent over plain http to remote hosts, agent
41
+ programs get a minimal environment, log paths must end in `.jsonl`, results and errors are
42
+ redacted, file plugins show a notice, and judges treat transcripts as data.
43
+
44
+ ### Notes
45
+ - Python 3.8 to 3.13; plain `pip` works. The MCP adapter needs Python 3.10 or newer.
46
+ - No built-in model prices (ADR-0004): set `price` per model for exact costs.
@@ -0,0 +1,7 @@
1
+ # Code of Conduct
2
+
3
+ This project follows the [Contributor Covenant v2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
4
+
5
+ ## Reporting
6
+
7
+ Report unacceptable behavior to the lead maintainer at **magadetejas5@gmail.com**. All reports are reviewed promptly and kept confidential. The maintainers will act as the Covenant's enforcement guidelines describe.
@@ -0,0 +1,43 @@
1
+ # Contributing to AgentPlay
2
+
3
+ Thanks for helping! AgentPlay is **spec-driven**: the spec in `specs/` is the source of truth.
4
+
5
+ ## Dev setup
6
+ Python 3.8+ with plain pip:
7
+ ```bash
8
+ python -m venv .venv && . .venv/bin/activate
9
+ pip install -e ".[dev]"
10
+ pre-commit install
11
+ ```
12
+ `uv` also works (`uv venv && uv pip install -e ".[dev]"`).
13
+
14
+ ## Checks (same as CI)
15
+ ```bash
16
+ python scripts/check_spdx.py && python scripts/check_boundaries.py
17
+ ruff check . && ruff format --check . && mypy && pytest
18
+ ```
19
+
20
+ ## More checks
21
+ ```bash
22
+ python scripts/check_spec_links.py # every requirement ID has a test (PRO-011)
23
+ python scripts/check_licenses.py # dependencies stay MIT-compatible
24
+ pip install -e ".[docs]" && mkdocs serve # docs site at http://127.0.0.1:8000
25
+ ```
26
+
27
+ ## Workflow
28
+ 1. Open an issue (or pick `good first issue` / `world-request`).
29
+ 2. If behavior changes, open a **spec PR first** (`specs/TEMPLATE.md`, see SPEC-000). Public-interface changes get a 3-day comment window.
30
+ 3. Add conformance tests (`tests/conformance/`) named after requirement IDs, e.g. `ENV-012`.
31
+ 4. Implementation PR links the spec and test IDs. Spec and code changes go in separate commits.
32
+
33
+ ## Rules
34
+ - Schemas live in `specs/schemas/`; the package ships copies in `src/agentplaykit/schemas/`. After changing one, run `cp specs/schemas/*.json src/agentplaykit/schemas/` (a test fails if they differ).
35
+ - If a change to the log format is intended, regenerate the golden log with `UPDATE_GOLDEN=1 pytest -k golden` and explain why in the PR.
36
+ - Every Python file starts with `# SPDX-License-Identifier: MIT`.
37
+ - Sign off commits (`git commit -s`) per the [Developer Certificate of Origin](https://developercertificate.org/). No CLA.
38
+ - `core` must not import `agents`, `envs` or `evals`.
39
+ - Runtime code must work on Python 3.8 (no `match`, no `str.removeprefix`, no runtime `list[str]`).
40
+ - No test may need a network connection or an API key (opt-in live tests live in `tests/live/`).
41
+ - New requirements need a test named after their ID, or an entry in `specs/untested.yaml` with a reason.
42
+
43
+ Releases follow `docs/release-checklist.md`.
@@ -0,0 +1,6 @@
1
+ # Governance
2
+
3
+ - A single lead maintainer accepts specs. More maintainers are added once someone has landed several accepted specs and reviews.
4
+ - Public interface changes need an accepted spec and a 3-day comment window; everything else follows normal review.
5
+ - Significant decisions are recorded as ADRs in `docs/adr/`.
6
+ - To become a maintainer: land several accepted specs and review regularly, then ask in Discussions.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AgentPlay contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,10 @@
1
+ # Maintainers
2
+
3
+ | Name | GitHub | Role |
4
+ | --- | --- | --- |
5
+ | Tejas | @thetejasmagade | Lead maintainer |
6
+
7
+ ## Contact
8
+
9
+ - **Code of Conduct reports:** magadetejas5@gmail.com (read only by the lead maintainer).
10
+ - **Security vulnerabilities:** report privately through GitHub's *Report a vulnerability*; see `SECURITY.md`.
@@ -0,0 +1,123 @@
1
+ Metadata-Version: 2.5
2
+ Name: agentplaykit
3
+ Version: 0.1.0
4
+ Summary: A framework for putting AI agents into worlds, letting them act and talk, and scoring and logging what happens.
5
+ Project-URL: Homepage, https://github.com/thetejasmagade/agentplay
6
+ Project-URL: Documentation, https://agentplay.itejas.dev/
7
+ Project-URL: Changelog, https://github.com/thetejasmagade/agentplay/blob/master/CHANGELOG.md
8
+ Project-URL: Issues, https://github.com/thetejasmagade/agentplay/issues
9
+ Author: AgentPlay contributors
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: agents,ai,benchmark,evaluation,llm,multi-agent,simulation
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.8
22
+ Requires-Dist: jsonschema>=4.18
23
+ Requires-Dist: pyyaml>=6.0
24
+ Provides-Extra: anthropic
25
+ Requires-Dist: anthropic; extra == 'anthropic'
26
+ Provides-Extra: dev
27
+ Requires-Dist: mypy>=1.10; extra == 'dev'
28
+ Requires-Dist: pre-commit; extra == 'dev'
29
+ Requires-Dist: pytest-cov>=5; extra == 'dev'
30
+ Requires-Dist: pytest>=8; extra == 'dev'
31
+ Requires-Dist: ruff>=0.5; extra == 'dev'
32
+ Requires-Dist: types-jsonschema; extra == 'dev'
33
+ Requires-Dist: types-pyyaml; extra == 'dev'
34
+ Provides-Extra: docs
35
+ Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
36
+ Requires-Dist: mkdocs>=1.6; extra == 'docs'
37
+ Provides-Extra: mcp
38
+ Requires-Dist: mcp>=1.2; (python_version >= '3.10') and extra == 'mcp'
39
+ Description-Content-Type: text/markdown
40
+
41
+ # AgentPlay
42
+
43
+ An MIT-licensed Python framework for putting AI agents into worlds, letting them act and talk, and scoring and logging what happens.
44
+
45
+ **Status:** v0.1.0 release candidate. Docs: <https://agentplay.itejas.dev>. The specs in [`specs/`](specs/) are the source of truth; every requirement has a test.
46
+
47
+ ## Install
48
+ Python 3.8 or newer. Plain `pip` works:
49
+ ```bash
50
+ pip install agentplaykit # once released
51
+ pip install -e ".[dev]" # from a clone, for development
52
+ ```
53
+
54
+ ## Try it
55
+ ```bash
56
+ pip install -e . # from a clone (PyPI release pending)
57
+ agentplaykit play # built-in demo, no API key needed
58
+ agentplaykit play examples/guess/scenario.yaml # a custom world + agent from plain .py files
59
+ agentplaykit play examples/ox-chat/scenario.yaml # two agents play OX and chat between moves
60
+ agentplaykit check examples/guess/scenario.yaml # validate without running
61
+ agentplaykit env list # available worlds
62
+ agentplaykit doctor # check your setup
63
+ ```
64
+ Every move, message and cost lands in a JSONL log under `runs/`.
65
+
66
+ A scenario is one YAML file; swap an agent by changing its `use` line:
67
+ ```yaml
68
+ agentplay: 1
69
+ name: ox-demo
70
+ seed: 7
71
+ world: {use: ox}
72
+ agents:
73
+ - {id: x, use: scripted/minimax}
74
+ - {id: o, use: scripted/random}
75
+ ```
76
+ 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.
77
+
78
+ ## Use real AI models
79
+ Any model can play, hosted or local. Change the agent's `use` line:
80
+
81
+ | `use` | Connects to |
82
+ |---|---|
83
+ | `openai_compat` | Any OpenAI-compatible API: OpenAI, OpenRouter, and local servers (Ollama, LM Studio, vLLM, llama.cpp) |
84
+ | `anthropic` | Claude via the Anthropic SDK (`pip install "agentplaykit[anthropic]"`) |
85
+ | `command` | Any program, in any language, reading and writing JSON lines |
86
+ | `http` | Any agent behind a URL |
87
+ | `mcp` | A tool on an MCP server (`pip install "agentplaykit[mcp]"`, Python 3.10+) |
88
+
89
+ ```yaml
90
+ - id: x
91
+ use: openai_compat
92
+ config: {base_url: "http://localhost:11434/v1", model: "llama3.2"} # local Ollama, free
93
+ ```
94
+ Keys come from environment variables (`api_key_env: OPENROUTER_API_KEY`), never from the scenario.
95
+ Every call's tokens and cost are logged; runs stop at `max_cost_usd` (default $1). Set `price`
96
+ per model for exact costs. See `examples/ox-llm/scenario.yaml` and `examples/command-agent/`.
97
+
98
+ ## Score and compare
99
+ Add evaluators to a scenario; they read only the finished log, so agents can never touch them:
100
+ ```yaml
101
+ evaluators:
102
+ - {use: outcome, config: {agent: x}} # did x win?
103
+ - {use: judge, config: {rubric: "Did x explain its moves?", agent: {use: openai_compat, config: {...}}}}
104
+ ```
105
+ Run many seeds and get a summary (pass rate, steps, cost, spread):
106
+ ```bash
107
+ agentplaykit play examples/treasure/scenario.yaml --runs 20
108
+ ```
109
+ Check your own world or agent against the specs before sharing it:
110
+ ```bash
111
+ agentplaykit test my_world.py
112
+ agentplaykit test my_agent.py --world ox
113
+ ```
114
+
115
+ ## Develop
116
+ ```bash
117
+ python -m venv .venv && . .venv/bin/activate
118
+ pip install -e ".[dev]"
119
+ pytest
120
+ ```
121
+ (`uv` works too: `uv venv && uv pip install -e ".[dev]"`.)
122
+
123
+ See [CONTRIBUTING.md](CONTRIBUTING.md). Licensed under [MIT](LICENSE).
@@ -0,0 +1,83 @@
1
+ # AgentPlay
2
+
3
+ An MIT-licensed Python framework for putting AI agents into worlds, letting them act and talk, and scoring and logging what happens.
4
+
5
+ **Status:** v0.1.0 release candidate. Docs: <https://agentplay.itejas.dev>. The specs in [`specs/`](specs/) are the source of truth; every requirement has a test.
6
+
7
+ ## Install
8
+ Python 3.8 or newer. Plain `pip` works:
9
+ ```bash
10
+ pip install agentplaykit # once released
11
+ pip install -e ".[dev]" # from a clone, for development
12
+ ```
13
+
14
+ ## Try it
15
+ ```bash
16
+ pip install -e . # from a clone (PyPI release pending)
17
+ agentplaykit play # built-in demo, no API key needed
18
+ agentplaykit play examples/guess/scenario.yaml # a custom world + agent from plain .py files
19
+ agentplaykit play examples/ox-chat/scenario.yaml # two agents play OX and chat between moves
20
+ agentplaykit check examples/guess/scenario.yaml # validate without running
21
+ agentplaykit env list # available worlds
22
+ agentplaykit doctor # check your setup
23
+ ```
24
+ Every move, message and cost lands in a JSONL log under `runs/`.
25
+
26
+ A scenario is one YAML file; swap an agent by changing its `use` line:
27
+ ```yaml
28
+ agentplay: 1
29
+ name: ox-demo
30
+ seed: 7
31
+ world: {use: ox}
32
+ agents:
33
+ - {id: x, use: scripted/minimax}
34
+ - {id: o, use: scripted/random}
35
+ ```
36
+ 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.
37
+
38
+ ## Use real AI models
39
+ Any model can play, hosted or local. Change the agent's `use` line:
40
+
41
+ | `use` | Connects to |
42
+ |---|---|
43
+ | `openai_compat` | Any OpenAI-compatible API: OpenAI, OpenRouter, and local servers (Ollama, LM Studio, vLLM, llama.cpp) |
44
+ | `anthropic` | Claude via the Anthropic SDK (`pip install "agentplaykit[anthropic]"`) |
45
+ | `command` | Any program, in any language, reading and writing JSON lines |
46
+ | `http` | Any agent behind a URL |
47
+ | `mcp` | A tool on an MCP server (`pip install "agentplaykit[mcp]"`, Python 3.10+) |
48
+
49
+ ```yaml
50
+ - id: x
51
+ use: openai_compat
52
+ config: {base_url: "http://localhost:11434/v1", model: "llama3.2"} # local Ollama, free
53
+ ```
54
+ Keys come from environment variables (`api_key_env: OPENROUTER_API_KEY`), never from the scenario.
55
+ Every call's tokens and cost are logged; runs stop at `max_cost_usd` (default $1). Set `price`
56
+ per model for exact costs. See `examples/ox-llm/scenario.yaml` and `examples/command-agent/`.
57
+
58
+ ## Score and compare
59
+ Add evaluators to a scenario; they read only the finished log, so agents can never touch them:
60
+ ```yaml
61
+ evaluators:
62
+ - {use: outcome, config: {agent: x}} # did x win?
63
+ - {use: judge, config: {rubric: "Did x explain its moves?", agent: {use: openai_compat, config: {...}}}}
64
+ ```
65
+ Run many seeds and get a summary (pass rate, steps, cost, spread):
66
+ ```bash
67
+ agentplaykit play examples/treasure/scenario.yaml --runs 20
68
+ ```
69
+ Check your own world or agent against the specs before sharing it:
70
+ ```bash
71
+ agentplaykit test my_world.py
72
+ agentplaykit test my_agent.py --world ox
73
+ ```
74
+
75
+ ## Develop
76
+ ```bash
77
+ python -m venv .venv && . .venv/bin/activate
78
+ pip install -e ".[dev]"
79
+ pytest
80
+ ```
81
+ (`uv` works too: `uv venv && uv pip install -e ".[dev]"`.)
82
+
83
+ See [CONTRIBUTING.md](CONTRIBUTING.md). Licensed under [MIT](LICENSE).