When a task involves gathering or processing information from multiple sources, a single agent can quickly fill its context window with intermediate tool calls and results. TrueFoundry Agent Harness solves this by automatically spinning up subagents — lightweight, isolated agent runs that handle focused subtasks in parallel and return only their final results to the root agent. The root agent stays focused on high-level coordination. Subagents do the heavy lifting.Documentation Index
Fetch the complete documentation index at: https://www.truefoundry.com/llms.txt
Use this file to discover all available pages before exploring further.
Why subagents?
Subagents solve the context bloat problem. When an agent uses tools with large outputs — API responses, search results, file contents — the context window fills up with intermediate data that is only needed temporarily. As the context grows, the agent becomes slower, more expensive, and more prone to errors. Subagents isolate this work. Each subagent runs with its own context, makes its own tool calls, and returns only a concise result. The root agent never sees the dozens of intermediate steps that produced it.- Without Subagents
- With Subagents
The agent processes everything sequentially in a single context:
- Agent looks up members of the team
- Agent works on each team member one by one, looks up pull requests and creates a summary for each
- All intermediate tool calls and their results stay in the context window
- Agent needs to look back through a large, cluttered context to produce the final answer
- Context bloat carries over to future turns
- Multi-step research across several entities (users, repos, services) that can run in parallel
- Tasks where intermediate tool output is large but the final answer is a summary
- Work that benefits from isolation — each subtask gets a clean context to reason in
How it works
The root agent decides at runtime whether to delegate. When it does, it generates focused instructions for each subagent, spawns them, and waits for results.- Shared tools and sandbox — Subagents have access to the same MCP tools and sandbox environment as the root agent.
- No user interaction — Subagents cannot ask the user questions or send messages directly. Only the root agent communicates with the user.
- No nesting — Subagents cannot create other subagents. Delegation is one level deep.
- Parallel execution — Multiple subagents run concurrently. The root agent waits for all of them before continuing.
Example
In this example, the user asks for a summary of work merged by a team. The root agent looks up team members, then delegates PR research for each member to parallel subagents.User
Can you please give me a summary of work merged by “agent” team in agent-runtime in last 7 days?
Assistant
get_team_members
get_team_members
Tool CallTool Response
Assistant
These subagents run in parallel and return their final assistant messages to the main agent.
The main agent waits for all the subagents to finish and then combines the results to produce the final answer.
Subagent: bob-prs
Subagent: bob-prs
System
These instructions are generated by the main agent for the subagent to execute.
- query: “repo:truefoundry/agent-runtime author:bob is:merged merged:>=2026-05-15”
- PR number and title
- Merged date
- A brief 1-2 sentence description of what the PR does (infer from the title or any available description)
Assistant
search_pull_requests
search_pull_requests
Tool Call
Assistant
-
Merged: 2026-05-20
Description: Adds a new responseUpdatedAt timestamp field to ResponseInStore … -
Merged: 2026-05-19
Description: Fixes sandbox initialization by symlinking the uploaded mcp_client.py as mcp-client
Subagent: alice-prs
Subagent: alice-prs
System
These instructions are generated by the main agent for the subagent to execute.
- query: “repo:truefoundry/agent-runtime author:alice is:merged merged:>=2026-05-15”
- PR number and title
- Merged date
- A brief 1-2 sentence description of what the PR does (infer from the title or any available description)
Assistant
search_pull_requests
search_pull_requests
Tool Call
Assistant
No PRs merged by alice in the last 7 days.
Assistant
Here is a summary of work merged by the agent team in the last 7 days:
- Alice: No PRs merged in the last 7 days.
- Bob: 2 PRs merged in the last 7 days. The theme of work is around sandbox initialization and responseUpdatedAt … …
Tracing subagent execution
Every subagent run is traced end-to-end alongside the root agent. In the Request Traces view, you can see the root agent span, each subagent span (with its name, duration, and step count), and the individual tool calls within each subagent.

Streaming events
Each agent execution — root and subagent — is identified by a uniqueexecution_id in the stream. Subagent lifecycle is marked by agent.created and agent.done events. For the full event reference and a working client example, see Using API — Subagents.