mcp capability.
1. Write the subagent as a function
Calling an@env.template mints a task; running it drives a fresh rollout whose Job carries the result. Wrap that in a function and return the agent’s answer:
subagents.py
issue_id: str becomes the one parameter, the docstring becomes the description.
2. Register it as an MCP tool
Use a baseline FastMCP server — type hints + docstring become the schema, no subclass required:subagents.py
3. Expose it as an mcp capability
An orchestrating environment declares an mcp capability pointing at that server, so any harness that opens it sees investigate_issue as a callable tool:
env.py
tools.run(transport="http", host="127.0.0.1", port=8080); in a built image, start it from your container entrypoint or an @env.initialize hook. See Capabilities for the mcp capability details.
How it looks to the orchestrator
The orchestrating agent opens themcp capability, sees one tool — investigate_issue(issue_id) — calls it, and gets the specialist’s findings back as the tool result. From its side it’s a single tool call; underneath, a whole sub-rollout ran. Each subagent rollout streams under its own trace, so you can inspect the specialist’s work separately from the orchestrator’s.
Because the tool is an ordinary function, everything composes normally: add retries, fan out to several specialists, post-process the answer, or swap create_agent("claude-haiku-4-5") for any other model — all in plain Python.