tpu-agent-suite
What it is. A package of skills and specialist agents for running PyTorch inference workloads on Cloud TPU from inside a coding agent, in preview. One canonical package (package/) is compiled into a native distribution per harness, installed into a workspace, and backed at run time by a Python runtime that validates every request and result against a schema and runs every TPU job through one compute CLI. The README lists Claude Code and Antigravity, with Codex and Cursor coming soon. Documented here at version 0.7.0. Upstream: https://github.com/google-pytorch/tpu-agent-suite. The book teaches it in chapter 26.
Layout
| Path |
What lives there |
framework/compiler.py |
compose, verify, lint, translate, archive: builds harness distributions from package/ |
framework/installer.py |
install and uninstall into a project or user scope, with a central store under ~/.tpu-agent-suite/ |
framework/runtime.py |
start-run, validate, journal, study, compute, config, trajectory, hook-dispatch |
framework/compute/ |
The compute CLI and its drivers (local, gce_tpu_vm, gke_pod, gke_job, gke_xpk), lease.py (lease grace period: the constant LEASE_GRACE_SECONDS = 120) |
framework/study.py, journal.py |
Multi-session optimization studies with noise-floor gates; the per-run experiment journal |
package/skills/, package/agents/ |
Skills (tpu-agent is the entry point; in the release build it routes to four specialists) and specialist agents (tpu-model-onboarding, tpu-diagnostics, tpu-kernel-development, tpu-knowledge-base, ...) |
package/schemas/ |
JSON schemas for every request and result (kernel-request.json, onboarding-result.json, ...); in the kernel request, max_iterations (default 5) is the tuning loop's only stop condition, with no time budget |
package/package.release.json, package.experimental.json |
What ships: two released skills; eleven more in the experimental build |
package/references/, package/scripts/, package/data/ |
Instructions, scripts and the knowledge-base index (data/tpu-knowledge-base/) the agents use |
eval/ |
Harbor evaluation suites: run.py, setup.sh, verify.sh, sandbox.sh, datasets/, verifiers/ |
Makefile, docs/ |
Build, verify and test targets; install, using and design documents |
Entry points
| Command |
What it does |
Source |
Taught in |
make verify |
Gate: manifest, graph, schemas, enforced content checks, knowledge base |
Makefile |
Ch 26 |
make build, make archives |
Distributions for every harness under dist/<harness>/tpu-agent-suite; release .tar.gz archives |
Makefile |
Ch 26 |
make lint, make test |
Advisory content lint; framework, package and knowledge-base test suites |
Makefile |
Ch 26 |
python3 framework/compiler.py translate package --harness claude-code --output DIR |
Builds one harness distribution |
compiler.py |
Ch 26 |
python3 <dist>/framework/installer.py install --destination /path/to/project |
Installs a distribution into a project; --scope user for a global install, uninstall to remove |
installer.py |
Ch 26 |
runtime.py compute --package tpu-agent-suite@0.7.0 setup plan, setup apply --profile default --answers answers.json, setup verify --profile default --smoke-test |
Creates and checks a compute profile |
compute/ |
Ch 26 |
runtime.py compute inspect, versions, preflight |
Topology and chips; jax, libtpu, torch and torch_tpu versions; backend checks |
compute/cli.py |
Ch 26 |
runtime.py compute run, submit, job cancel, job reap --include-serving |
Synchronous runs, asynchronous jobs, and cleanup (serving jobs outlive the session) |
compute/cli.py |
Ch 26 |
runtime.py validate, journal {add,show,render}, trajectory export |
Validate a payload against a schema; the run's journal; export a session trajectory |
runtime.py |
Ch 26 |
./eval/setup.sh, ./eval/verify.sh smoke-check, ./eval/run.py --config claude-code/agent-suite claude-code/baseline --dataset tpu-hello-world |
Harbor evaluation against a control arm with no package installed |
eval/README.md |
Ch 26 |
TPU_AGENT_SUITE_HOME |
Root of the central store; a test-isolation seam, not a relocation feature |
framework/utils.py |
Ch 26 |
TPU_AGENT_SUITE_DISABLE_SCHEMA_VERIFIERS |
Turns off schema validation of requests and results; leave it unset |
runtime.py |
Ch 26 |
In this book, code/samples/agent_suite/run_workflow.py validates request payloads against the vendored 0.7.0 schemas on a laptop (--cpu-smoke, --validate-only).
Extension points
| You want to |
Where |
Rule the compiler enforces |
| Add a skill |
package/skills/<name>/SKILL.md, listed in a manifest |
Only skills may declare the ask tool |
| Add a specialist |
package/agents/<name>.md with delegates, scripts and references frontmatter |
An agent that declares ask fails verify |
| Reference package files |
Tokens such as {{script:...}}, {{schema:...}}, {{runtime}} |
Literal scripts/... or references/... paths in prose fail verify |
| Define a hand-off |
A request and result schema in package/schemas/ |
Every request and result is validated at run time; a completed result must list an artifact |
Tests
make test # framework, package and knowledge-base suites (unittest)
make test-framework # python -m unittest discover -s framework/tests
make verify # the CI gate