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

> Build and run managed AI agents on TrueFoundry with MCP tools, skills, sandboxing, approvals, governance, and observability built in.

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

For the full concept and how the runtime fits together, see [What is an agent harness?](https://trueforge.dev/introduction) on the TrueForge docs.

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

## TrueFoundry Agent Harness

TrueFoundry Agent Harness is the **hosted version of [TrueForge](https://trueforge.dev/introduction)** — the open-source agent harness maintained by TrueFoundry ([github.com/truefoundry/trueforge](https://github.com/truefoundry/trueforge)).

TrueForge runs the core agent loop — model calls, MCP tools, skills, sandboxing, approvals, context management, and session state. TrueFoundry runs that same harness for you and adds the layers needed to operate agents across a team:

* **Governance** — Models, MCP servers, and skills are managed through the AI Gateway, MCP Gateway, and Skills Registry. No API keys in agent definitions, plus RBAC, budgets, rate limits, and guardrails.
* **Observability** — Every agent session is captured with cost, tokens, turns, tool calls, and end-to-end traces in one place. See [Observability](/docs/agent-platform/agent-harness/observability).
* **Enterprise hosting** — Run as SaaS, self-hosted, or on-prem in your own cloud and region.

For the full breakdown — including how it compares to other hosted runtimes — see [What TrueFoundry Adds on Top of TrueForge](/docs/agent-platform/agent-harness/what-truefoundry-adds).

You choose a model, connect MCP servers, add skills, and write instructions. TrueFoundry manages orchestration, sandbox lifecycle, tool execution, approvals, governance, and observability.

<Frame caption="Build a managed agent by selecting a model, connecting MCP servers, adding skills, and writing instructions">
  <img src="https://mintcdn.com/truefoundry/sRJHwFb35bXgeP_o/docs/agent-platform/agent-harness/images/builder.png?fit=max&auto=format&n=sRJHwFb35bXgeP_o&q=85&s=9dbe4c7414cf9afe441c21a873c85d3f" alt="TrueFoundry Agent Harness builder showing model selection, MCP servers, skills, instructions, and a playground test button" width="1024" height="608" data-path="docs/agent-platform/agent-harness/images/builder.png" />
</Frame>

## Harness Capabilities

You configure four things on TrueFoundry — models, MCP servers, skills, and how you monitor them — and the harness runs the rest of the execution loop.

<CardGroup cols={2}>
  <Card title="Models" icon="brain" href="/docs/agent-platform/agent-harness/models">
    Any provider through AI Gateway, with model-level RBAC, budgets, and routing.
  </Card>

  <Card title="MCP Servers" icon="plug" href="/docs/agent-platform/agent-harness/mcp-servers">
    Governed MCP tools with centralized auth, in-chat OAuth, and per-user delegation.
  </Card>

  <Card title="Skills" icon="book" href="/docs/agent-platform/agent-harness/skills">
    Versioned `SKILL.md` instructions from the Skills Registry, mounted on demand.
  </Card>

  <Card title="Observability" icon="chart-line" href="/docs/agent-platform/agent-harness/observability">
    Inspect every agent session with cost, tokens, turns, tool calls, and end-to-end traces.
  </Card>
</CardGroup>

### Capabilities that run in the harness

Sandboxing, context engineering, human checkpoints, and Generative UI are part of the open-source [TrueForge](https://trueforge.dev/introduction) harness. The mechanics are documented in the [TrueForge docs](https://trueforge.dev/key-features/overview); TrueFoundry runs them for you as a managed, governed service.

| Capability            | What it does                                                                        | TrueForge reference                                                               |
| --------------------- | ----------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| Sandbox               | Isolated code, file, and shell execution, provisioned only when the agent needs one | [Setup 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)               |

TrueFoundry runs these as a managed, governed service — with a colocated low-latency sandbox, sensible defaults, org-wide approval policy, and full observability. See [What TrueFoundry Adds on Top of TrueForge](/docs/agent-platform/agent-harness/what-truefoundry-adds) for governance, the managed runtime, enterprise hosting, and how it compares to other hosted runtimes.

## Architecture

Agent Harness runs in the same gateway plane as model and MCP traffic, so orchestration, governance, and observability stay in one system.

<Frame caption="Agent Harness brings orchestration, sandboxing, approvals, MCP access, model governance, skills, and observability into one managed system">
  <img src="https://mintcdn.com/truefoundry/sRJHwFb35bXgeP_o/docs/agent-platform/agent-harness/images/overview.png?fit=max&auto=format&n=sRJHwFb35bXgeP_o&q=85&s=34486911eb5cbdfa7af08f78d2956480" alt="TrueFoundry Agent Platform architecture showing sandbox, subagents, generative UI, context management, human-in-the-loop approvals, model gateway, MCP gateway, skills registry, and observability" width="1536" height="1024" data-path="docs/agent-platform/agent-harness/images/overview.png" />
</Frame>

## Start Building

Create an agent by choosing a model, connecting MCP servers, adding skills, and writing instructions. Then test in playground, integrate via API, monitor through traces and metrics, and ship it to users.

<CardGroup cols={2}>
  <Card title="What TrueFoundry Adds" icon="layer-group" href="/docs/agent-platform/agent-harness/what-truefoundry-adds">
    Governance, observability, managed runtime, and hosting on top of TrueForge.
  </Card>

  <Card title="Build From UI" icon="display" href="/docs/agent-platform/agent-harness/getting-started">
    Create and test a managed agent from the TrueFoundry console.
  </Card>

  <Card title="Use the SDK" icon="code" href="/docs/agent-platform/agent-harness/sdk/overview">
    Create sessions, stream progress, and integrate Agent Harness into your application.
  </Card>

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