Skip to content

docs(agents): add a guide to writing an A2A agent - #279

Merged
psinghal20 merged 8 commits into
mainfrom
pratyush/agents-md
Oct 21, 2026
Merged

psinghal20 merged 8 commits into
mainfrom
pratyush/agents-md

Conversation

@psinghal20

@psinghal20 psinghal20 commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds src/agent_env/agents/AGENTS.md, a short guide to writing an A2A agent that agent-env can deploy, prompt, inspect and validate. It uses the Claude Code agent, agent-env's default and most tested agent, as the reference implementation, with pi only for the patterns Claude Code doesn't use (native trajectory, the snapshot changelog, custom peer tools), and points to the code rather than repeating it:

  • Agent: a Docker image running an SDK-built A2A server, with the end of agents/claude-code/a2a_server.py and its entrypoint.sh as the whole entry point, and where the agent-level plumbing lives (model endpoint mapping, error bodies, lifespan, image, offline tests).
  • Agent loop: handling tasks: the A2A methods agent-env calls (message/send, tasks/get, tasks/cancel), the task lifecycle the SDK owns, what run() receives and returns, errors, contexts and sessions, deadlines and cancellation, and streaming, each pointing to ClaudeCodeAgent.run, claude_bridge.py and their tests.
  • Agent Card: identity and input_modes, what the SDK derives (RPC URL, streaming, the extensions list and agent-config's supported fields), and what updates it live, pinned by test_card_contract.py.
  • Extensions: one section per urn:agentenv:* extension (agent-config, mcp-config, trajectory, skill-config, snapshot, peer-agents, triggers, attribution-probe, install, staging) and for custom extensions: what agent-env uses it for, what the SDK implements versus the agent, and the reference to copy, in Claude Code first, then pi, the protocol examples or its tests.
  • The protocol: extensions.py as the wire-format source of truth, tasks/v1.py, transfers.py, the protocol README, and the deploy_agent / prompt_agent steps that show what agent-env sends an agent.
  • Adding your own agent: ten steps from an empty bundle to a validated agent: copy agents/claude-code/, declare the agent, write the turn, map the model endpoint, add extensions, test offline, add agent.toml and a smoke task, agent-env run, a2a-agent put / validate, and use it from a task or as [agents] default_a2a_agent_id, with what validate doesn't cover.

It is about writing agents, not about changing the framework. Docs only; no code changes.

Test plan

  • Every file and symbol the guide references exists on main.
  • pytest tst/unit/agents tst/unit/bundle: 1040 passed.
  • agent-env run agents --dry-run still plans both agents and both smoke tasks with the file in the bundle.
  • Following steps 1, 7 and 8 (a copy of agents/claude-code/ as agents/my-agent/ in a new bundle, with a smoke task naming it by folder) plans with agent-env run <bundle> --dry-run.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The documentation change appears safe to merge.

Summary

Adds src/agent_env/agents/AGENTS.md, a guide to building, testing and registering an A2A agent.

  • A new guide shows developers how to build an A2A agent for agent-env.

Reviews (6) · Last reviewed commit: "docs(agents): drop the reference-agent s..." · Reviewed by Greptile

A short guide in the agents bundle for contributors and coding agents writing
or changing an A2A agent: the folder layout, where each pattern lives in the
claude-code and pi agents, where the protocol and the control plane's side are
defined, the rules that most often break an agent, and the commands to check a
change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@psinghal20
psinghal20 requested a review from a team as a code owner October 21, 2026 15:43
Drop the guidance on changing the framework itself (release pins, where the
shipped agents' tests and README entries go, protocol changes) and keep what
someone writing an agent needs: the agent's shape, where each pattern lives in
the claude-code and pi agents, the protocol references, the rules that most
often break an agent, and how to register and validate it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@psinghal20 psinghal20 changed the title docs(agents): add an AGENTS.md for writing the shipped agents docs(agents): add a guide to writing an A2A agent Oct 21, 2026
Comment thread src/agent_env/agents/AGENTS.md Outdated
Comment thread src/agent_env/agents/AGENTS.md Outdated
psinghal20 and others added 4 commits October 21, 2026 09:28
…ptile review findings

- Point every pattern at the Claude Code agent, the default and most tested
  one, and use pi only for what Claude Code doesn't do: native trajectory,
  the snapshot changelog and custom peer tools.
- Prefix the agent paths with agents/ so they resolve from this folder.
- Say that validate runs a fixed set of checks, and list what it doesn't
  cover, so a green run isn't read as proof for every advertised extension.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a section per urn:agentenv:* extension (agent-config, mcp-config,
trajectory, skill-config, snapshot, peer-agents, triggers, attribution-probe,
install, staging) and custom extensions: what agent-env uses it for, what the
SDK implements and what the agent does, and where to copy it from, in the
Claude Code agent first, then pi, the protocol examples or its tests. The
extension rules move into their sections, and kit.py is named explicitly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Organize AGENTS.md as Agent, Agent loop, Agent Card and Extensions. The agent
loop section covers core A2A task handling: the JSON-RPC methods agent-env
calls, the task lifecycle the SDK owns, what run() receives and returns,
errors, contexts and sessions, deadlines and cancellation, and streaming. The
Agent Card section covers identity, what the SDK derives and what updates it
live. Each points to the Claude Code agent and its tests; the remaining rules
move into those sections.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A numbered walk-through from an empty bundle to a validated agent: copy the
Claude Code agent's folder, declare the agent, write the turn, map the model
endpoint, add extensions, test offline, add defaults and a smoke task, run the
bundle, register and validate, and use the agent from a task or as the
default. It absorbs the registering and validating section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread src/agent_env/agents/AGENTS.md Outdated
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@psinghal20
psinghal20 merged commit 258f430 into main Oct 21, 2026
14 checks passed
@psinghal20
psinghal20 deleted the pratyush/agents-md branch October 21, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants