> ## 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.

# Agent Harness

> TrueFoundry's agent harness is TrueForge, embedded unchanged in the platform, with hosting and deep AI Gateway integration on top.

## What is an agent harness?

An agent harness is the runtime layer around an LLM that turns it into a reliable, long-running agent. Instead of only generating text, the harness manages the full execution loop: planning, tool calling, context management, approvals, state, and observability.

<Frame caption="The harness orchestrates the agent run, connecting the model, tools, sandbox, and approvals to deliver a safe, reliable result">
  <img src="https://mintcdn.com/truefoundry/sRJHwFb35bXgeP_o/docs/agent-platform/agent-harness/images/agent-harness-definition.png?fit=max&auto=format&n=sRJHwFb35bXgeP_o&q=85&s=b47f465082690ce1a36f540ed8256f1a" alt="Diagram of the Agent Harness sitting between a user goal and the final response and trace: the harness orchestrates the run, routes between model, tools and MCP servers, sandbox, and approval gates, enforces guardrails, and records every step, with arrows showing the harness sending requests to each component and components returning results and events" width="1536" height="1024" data-path="docs/agent-platform/agent-harness/images/agent-harness-definition.png" />
</Frame>

## TrueForge, embedded in TrueFoundry

The agent harness in TrueFoundry **is** [TrueForge](https://trueforge.dev) — the open-source agent harness maintained by TrueFoundry ([github.com/truefoundry/trueforge](https://github.com/truefoundry/trueforge)). It is embedded in the platform as-is, not forked or re-implemented, so there is no behavioural difference between the two.

That means the [TrueForge documentation](https://trueforge.dev) is the reference for everything the harness does — agent definitions, runtime configuration, sandboxing, subagents, context management, human checkpoints, Generative UI, the HTTP API, and the TypeScript SDK. This section only covers what TrueFoundry adds around it.

You build and run agents from **TRUEFORGE → Build Agents** in the platform sidebar.

<Frame caption="The agent builder at TRUEFORGE → Build Agents: model, instructions, runtime config, MCP servers, and skills on the left, a live chat to test against on the right">
  <img src="https://mintcdn.com/truefoundry/YrRiSjE0y50MrR2U/docs/agent-platform/agent-harness/images/trueforge-build-agent.png?fit=max&auto=format&n=YrRiSjE0y50MrR2U&q=85&s=d40f38b1478d640f33358982df01bae4" alt="TrueForge agent builder inside the TrueFoundry platform, showing the Agent Config panel with model selection, instructions, runtime config toggles for sandbox, compaction, large tool response, dynamic sub-agents, generative UI and ask user questions, plus MCP Servers and Skills sections, alongside a chat panel for testing the agent" width="1453" height="791" data-path="docs/agent-platform/agent-harness/images/trueforge-build-agent.png" />
</Frame>

## Where to find each topic

<CardGroup cols={2}>
  <Card title="TrueForge documentation" icon="book-open" href="https://trueforge.dev">
    The full reference for the harness, its configuration, and its APIs.
  </Card>

  <Card title="What TrueFoundry adds" icon="layer-group" href="/docs/agent-platform/agent-harness/what-truefoundry-adds">
    Hosting and deep AI Gateway integration on top of open-source TrueForge.
  </Card>
</CardGroup>

| Topic | TrueForge reference |
| - | - |
| Concepts and a first agent | [Quickstart](https://trueforge.dev/quickstart) |
| Defining an agent — instructions, runtime config, tools, skills | [Create an Agent](https://trueforge.dev/create-agent/overview) |
| Choosing and configuring models | [Models](https://trueforge.dev/models) |
| Connecting MCP servers and selecting tools | [MCP Servers](https://trueforge.dev/mcp-servers) |
| Sandboxed code, file, and shell execution | [Sandbox](https://trueforge.dev/sandbox) |
| Integrating an agent into your application | [SDK Quickstart](https://trueforge.dev/api/quickstart) and [Use an Agent](https://trueforge.dev/api/use-agent) |
| Turn events, sessions, approvals, and streaming | [Use an Agent](https://trueforge.dev/api/use-agent) |
| Full REST API | [API reference](https://trueforge.dev/api-reference/agents/list-agents) |

<Note>
  Agents created before the TrueForge portal were migrated automatically — there is nothing to recreate. The previous TrueFoundry agent APIs keep working until **15th October, 2026**; migrate to the [TrueForge API](https://trueforge.dev/api/use-agent) before then. See [Agents are moving to TrueForge](/docs/change-announcements/agents-moving-to-trueforge).
</Note>

## Capabilities that run in the harness

Sandboxing, context engineering, subagents, human checkpoints, and Generative UI are all part of open-source TrueForge and are documented in the [TrueForge docs](https://trueforge.dev/key-features/overview). TrueFoundry runs them for you with sensible defaults — every toggle in **Runtime Config** is on out of the box.

| Capability | What it does | TrueForge reference |
| - | - | - |
| Sandbox | Isolated code, file, and shell execution, provisioned only when the agent needs one | [Sandbox](https://trueforge.dev/sandbox) |
| Subagents | Delegate focused subtasks to parallel agents with their own clean context | [Subagents](https://trueforge.dev/key-features/subagents) |
| Deferred tool loading | Load MCP tool definitions on demand instead of upfront to keep context lean | [Deferred Tool Loading](https://trueforge.dev/key-features/deferred-tool-loading) |
| Code Mode | Chain and aggregate MCP tool calls in a single sandbox script | [Code Mode](https://trueforge.dev/key-features/code-mode) |
| Large tool responses | Offload oversized tool output to the sandbox instead of flooding context | [Large Tool Responses](https://trueforge.dev/key-features/large-tool-responses) |
| Context compaction | Summarize older history when context nears the model limit | [Harness Capabilities](https://trueforge.dev/key-features/overview) |
| Human checkpoints | Pause for tool approval or ask the user a structured question | [Harness Capabilities](https://trueforge.dev/key-features/overview) |
| Generative UI | Respond with interactive charts, tables, cards, and forms | [Harness Capabilities](https://trueforge.dev/key-features/overview) |

## What TrueFoundry adds

Two things sit on top of the open-source harness:

* **A hosted TrueForge** — the harness runs as a managed, multi-user service inside the platform, sharing its authentication, RBAC, and control plane. There is nothing to install or operate, and it is available as SaaS, self-hosted, or on-prem.
* **Deep AI Gateway integration** — the models, MCP servers, and skills already available to you in the gateway appear directly in the agent builder. No provider credentials, MCP endpoints, or skill sources have to be configured separately in TrueForge.

Because agent traffic flows through the same gateway as model and MCP traffic, cost, tokens, and tool calls for every session are captured without extra instrumentation.

<CardGroup cols={2}>
  <Card title="What TrueFoundry adds" icon="layer-group" href="/docs/agent-platform/agent-harness/what-truefoundry-adds">
    Hosting, gateway integration, and governance in detail.
  </Card>

  <Card title="Observability" icon="chart-line" href="/docs/agent-platform/agent-harness/observability">
    Track sessions, cost, and tool calls across every agent run.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.