SuperAPIAI Directory

agentry

github.com · AI agents

Agentry is an end-to-end testing framework for AI agents, positioned as "Playwright for AI agents." By driving real AI agent CLIs (such as Claude Code, Codex, Gemini, Antigravity), it observes and asserts structured behaviors during agent execution, such as tool calls, file creation, and token consumption, and supports record/replay for deterministic CI testing. It is currently in an early MVP stage, has not yet been published as an npm package, and must be run directly from the monorepo.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux · API

About this tool

Agentry is an end-to-end testing framework for testing AI agent infrastructure, with a design philosophy analogous to Playwright's testing of browsers: Playwright drives a real browser and asserts on the DOM, while Agentry drives a real AI agent CLI and asserts on what the agent "did"—which tools it called, which files it created, and how many tokens it consumed.

Purpose

Agentry primarily targets testing of the ecosystem around AI agents, including skills, MCP gateways, plugins, and more. These components tend to break when model behavior changes but the prompts do not, and Agentry is designed to help developers catch such issues.

Key Capabilities

  • Drives real agent CLIs: Supports four drivers—Claude Code, Codex, Gemini, and Antigravity—all running in headless mode, receiving prompts and a sandbox workspace.
  • Standardized event stream: Uniformly converts the output of different drivers into an AgentEvent stream, including assistant turns, tool calls, MCP requests, filesystem side effects, token usage, and more.
  • Structured assertions: Provides toHaveToolCall、toHaveFile、toFinishWithin and other matchers to make precise assertions about agent behavior, avoiding fragile string matching against free-text output.
  • Deterministic replay: By recording transcripts, replay in CI is fast (<2 seconds), free, and requires no agent. Record once, replay forever.
  • Sandbox isolation: Each scenario runs in a fresh temporary directory, with file side effects detected via content-hash snapshots.
  • Budget control: Supports setting a dollar budget cap per test, enforced after the run in the MVP, while also passing --max-budget-usd to the Claude CLI as a native fallback.
  • LLM interception proxy: Provides LlmProxy(via ANTHROPIC_BASE_URL), supporting byte-level wire recording, budget proxy gating, secret redaction, and more.
  • Mock MCP server: Provides a JSON-RPC core and a stdio shim, as well as toExposeTools、toHaveReceived and other MCP matchers.
  • CLI tool: Provides agentry test、record、init、doctor and other commands, supports model pinning and budget cap configuration, and the console reporter can display costs.

Usage

There is currently no published npm package; it must be run directly from the monorepo. Prerequisites: Node >= 20, pnpm >= 10, and the CLI for the driver you use on PATH (claude requires ANTHROPIC_API_KEY、codex、gemini or agy, each authenticated per the vendor's requirements). Replay-only runs do not require these. All TypeScript is executed directly via tsx, so no build step is needed for development.

Basic workflow:

  1. In agentry.config.ts , configure use.agent to select a driver (default claude),use.model requires a snapshot ID pinned for that agent.
  2. Write a TypeScript test file (e.g., tests/todo.agentry.ts); tests receive named fixtures via destructured parameters.
  3. Run agentry test to replay (using committed transcripts, no API key needed), or run agentry record to record (requires a real CLI and API key). Recorded transcripts are written to the __agentry__/<test-file-name>/ directory next to the test file and should be committed to the repository for hermetic replay in CI.
  4. You can use agentry init Scaffold a new project.

When running the agent, the following optional parameters are supported:allowedTools、disallowedTools、permissionMode、mcpConfig、appendSystemPrompt. All matchers support .not, which can apply to expect(agent)(RunView) or expect(workspace)(Sandbox).

Use cases

  • Test the end-to-end behavior of AI agent CLIs.
  • Verify the integration of MCP servers, skills, and plugins.
  • Implement fast, deterministic regression testing of agent behavior in CI.
  • Monitor the impact of model behavior changes on the agent ecosystem.

Limitations

  • Currently an early MVP; features are not yet complete, and some capabilities on the roadmap (such as wire-level cassette replay) are not yet implemented.
  • Not yet published as an npm package; must be run from the monorepo.
  • Replay is currently transcript replay (replaying a normalized event stream), not wire-level replay.
  • Antigravity-driven sandbox filesystem diff detection is best-effort, since it uses its own temporary directory.
  • Budget caps are enforced after the run in the MVP.

The project is licensed under the Apache License 2.0, copyright Francis Eytan Dortort.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools