adk
AGENTS.md83 starsChanged 39 days agoApache-2.0View on GitHub
polyai-adk is the poly CLI: a git-like workflow (pull, push, branch, diff, …) for building PolyAI Agent Studio agents locally as YAML and Python files. These rules apply to every coding agent and reviewer working in this repo. Review-specific guidance is in REVIEW.md, which repeats the rules below that matter in review: when you change one of those rules, update both. Run everything through uv run; don't activate the venv first. CI runs all of these on every PR, with…
- Installs packages
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository10 other files it gives its agents.
- add-resource-typeSkill
- ci-checkSkill
- open-prSkill
- review-prSkill
- write-testsSkill
- poly-adk-branchingSkill
- poly-adk-conversationsSkill
- poly-adk-rtcSkill
- poly-adk-testingSkill
- poly-adk-workflowSkill
The file
We split this AGENTS.md into the rules it gives an agent
11 rules. About 0 are common, 5 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Run everything through uv run.
- Very specific: line 71
Reuse before writing: Use make_request, load_yaml / dump_yaml (resources/resource_utils.py), each resource's discover_resources, …
- Distinctive: line 77
Delete, don't shim: When a platform field or behaviour is removed, delete it from the ADK.
- Distinctive: line 78
Don't keep back-compat paths or code nothing uses.
- Very specific: line 87
Comments explain why, briefly: No narration of the change, and no stray files (scratch scripts, BUILD.bazel, editor settings) in the diff.
- Very specific: line 92
Add to the existing test file and class for the area (e.g.
- Very specific: line 94
When a resource gains a field or a new resource type is added, add it to src/poly/tests/test_projects/test_project/ too.
- Distinctive: line 96
Prefer real objects and the fixture projects over mocks, and mock only at the API boundary.
- Very specific: line 110
Run uv run licensecheck --zero and uv run pip-licenses, and commit licenses.json.
- Distinctive: line 115
Every merge to main can release.
- Distinctive: line 131
No internal client names, project IDs, internal repos, services or tooling anywhere in a PR.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PolyAI ADK
polyai-adk is the poly CLI: a git-like workflow (pull, push, branch, diff, …) for
building PolyAI Agent Studio agents locally as YAML and Python files. These rules apply to every
coding agent and reviewer working in this repo. Review-specific guidance is in REVIEW.md, which
repeats the rules below that matter in review: when you change one of those rules, update both.
Commands
Run everything through uv run; don't activate the venv first.
| Task | Command |
| Install (with dev extras) | uv pip install -e ".[dev]" |
| Tests | uv run pytest src/poly/tests/ |
| Coverage | uv run pytest src/poly/tests/ --cov=poly --cov-report=term-missing |
| Lint / format | uv run ruff check . / uv run ruff format . |
| Licence check | uv run licensecheck --zero |
Regenerate licenses.json | uv run pip-licenses |
| Validate user skills | uv run python scripts/validate_skills.py |
CI runs all of these on every PR, with tests on Ubuntu and Windows, plus a check that the PR
title is a conventional commit. The ci-check skill runs the same set locally.
Layering
cli_commands/ → AgentStudioProject (project.py) → AgentStudioInterface → PlatformAPIHandler / sdk
user interaction logic and validation API facade HTTP / protobuf- Anything that acts on a project is a method on
AgentStudioProject, so it can be done programmatically asproject.<method>(). Tests and other tools build on the project directly, without going through the CLI. That includes reads: if a command needs project data, add a project method, even one that only forwards to the interface. project.pyowns the logic and validation: API calls, file I/O, merging, and checking inputs (raiseValueErrorwith a clear message). Validating there gives programmatic callers the same checks as the CLI.cli_commands/owns user interaction: argument parsing, prompts and confirmations,--jsonversus human output, and exit codes. Project methods never print, prompt or exit; they return data or raise, and the command decides how to show it.- Exception: commands that run before a project exists (
login,apikey,setup,init,project list/create) may callAgentStudioInterfacedirectly. Some project-scoped commands that still do (audio_cache.py,functions.py,conversations.py) are leftovers to fix, not patterns to copy. - New HTTP calls go through
PlatformAPIHandler.make_request. If it lacks something you need, extend it.
Where things go
| Path | What belongs there |
src/poly/cli.py | Thin dispatcher that registers command classes. No logic. |
src/poly/cli_commands/ | One module per command family. See src/poly/cli_commands/AGENTS.md. |
src/poly/project.py | AgentStudioProject: everything a command needs, scoped to one local project. |
src/poly/resources/ | One module per resource type that appears in the project projection. See src/poly/resources/AGENTS.md. |
src/poly/handlers/ | API clients: interface.py (facade), platform_api.py (REST), sdk.py (protobuf command queue), auth, GitHub, PostHog. |
src/poly/output/ | Terminal output (console.py) and --json output (json_output.py). |
src/poly/call/, src/poly/auth/ | Voice calls over WebRTC (the optional [call] extra), and the login device flow. |
src/poly/utils/ | Shared helpers: merge, credentials, JSON I/O, decorators, pre-push checks. |
src/poly/docs/ | Resource docs shipped in the wheel and served by poly docs. |
src/poly/tests/ | Tests, plus fixture projects in test_projects/. |
docs/docs/ | The public docs site (mkdocs). |
skills/ | User-facing agent skills, installed into users' projects by poly setup / poly update. |
.claude/skills/ | Contributor skills for working on this repo (ci-check, review-pr, write-tests, add-resource-type, open-pr). Marked metadata.internal: true so poly setup never installs them. |
Generated, never edit by hand: src/poly/handlers/protobuf/ and src/poly/types/.
Conventions
- Reuse before writing. Use
make_request,load_yaml/dump_yaml(resources/resource_utils.py), each resource'sdiscover_resources,load_project(cli_commands/shared.py) andjson_print. Don't add a parallel helper. - Match sibling commands. Same flag names (
--json,--path,--force), and--jsonskips confirmation prompts. Most commands are scoped to a project, and regions are writtenus-1/euw-1/uk-1. Use the existing name for a concept; don't invent a new one. - Delete, don't shim. When a platform field or behaviour is removed, delete it from the ADK. Don't keep back-compat paths or code nothing uses.
- Validate locally. Anything the platform would reject on push should fail in
poly validate/ pre-push first. A pull followed by a push must round-trip with no changes. - Guard side effects. Deletes touch only files the ADK owns. Anything that reaches
livesays so in its prompt and help text. - Code style: 100-char lines, type hints and docstrings on public functions, absolute
poly.imports,ValueErrorfor validation andSourcererAPIError(handlers/sdk.py) for API failures. User output goes throughoutput/console.pyorjson_printin the CLI layer, diagnostics throughlogging.getLogger(__name__), and never a bareprint. - Comments explain why, briefly. No narration of the change, and no stray files (scratch
scripts,
BUILD.bazel, editor settings) in the diff.
Tests
- Add to the existing test file and class for the area (e.g.
resources_test.py,cli_test.py,tests/api/,tests/call/). Create a new file or class only when nothing fits. - When a resource gains a field or a new resource type is added, add it to
src/poly/tests/test_projects/test_project/too. - Prefer real objects and the fixture projects over mocks, and mock only at the API boundary.
Docs and skills
A user-facing change updates, in the same PR:
docs/docs/: the command page inreference/cli/and anydevelopment/guide that covers it. Pages inreference/cli/andreference/resources/follow theAGENTS.mdin those directories.src/poly/docs/, when a resource's YAML shape changes (it backspoly docs).skills/, when a command, flag or workflow that a skill mentions changes.
Docs are public. Don't name real customers, projects or internal tools.
Dependencies
Run uv run licensecheck --zero and uv run pip-licenses, and commit licenses.json. Heavy or
platform-specific dependencies go in an optional extra (like [call]), not the base install.
Pull requests and releases
Every merge to main can release. The PR title becomes the squash commit, the version bump and
the public release note.
| Title type | Release |
feat: | Minor. Anything a user can see, including output or on-disk changes. |
fix:, perf: | Patch |
feat!: or a BREAKING CHANGE: footer | Major |
chore:, docs:, ci:, build:, refactor:, style:, test: | No release |
- Never edit version numbers by hand. semantic-release sets
pyproject.toml's version, stamps everyskills/*/SKILL.mdversion:and writesCHANGELOG.md. Adding a user skill means adding it toversion_variablesinpyproject.toml. - Fill in
.github/PULL_REQUEST_TEMPLATE.md, using its sections only. - No ticket IDs (Linear or otherwise) in the PR title or description. Link the ticket in a PR comment instead.
- No internal client names, project IDs, internal repos, services or tooling anywhere in a PR. The repo is public.
- Stacked PRs merge bottom-up. Retarget each one to
mainafter the PR below it merges. - One concern per PR. Small related fixes are fine; structural refactors get their own PR.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

