> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentium.in/llms.txt
> Use this file to discover all available pages before exploring further.

# @agentium/harness

> Compose tools and context, control execution, and own the lifecycle around Agentium agents, teams, workflows, and custom drivers.

`@agentium/harness` is Agentium's execution and composition package. Use it when your application needs to decide which tools and models a run can use, enforce shared budgets, compose reusable capabilities, or manage resources across runs.

An `Agent`, `Team`, or `Workflow` comes from `@agentium/core`. A driver connects it to `HarnessRuntime`. The runtime owns the session, grants, events, cancellation, and cleanup; the driver performs the work through controlled execution services.

<Note>
  This section targets `@agentium/harness@4.0.0` with matching `@agentium/core@4.0.0`. See [installation](/harness/quickstart) or [migration from Agent-owned harness configuration](/harness/migration).
</Note>

<Columns cols={2}>
  <Card title="Run your first harness" icon="terminal" href="/harness/quickstart">
    Start with a runnable local example, then connect a model-backed Agent.
  </Card>

  <Card title="API reference" icon="code" href="/harness/api/overview">
    Every public export, configuration type, and method signature.
  </Card>
</Columns>

## How the pieces fit

```mermaid theme={null}
flowchart TD
  D[Definition and abilities] --> R[HarnessRuntime]
  G[Grants and budgets] --> R
  P[Controllers and policies] --> R
  R --> E[Execution driver]
  E --> A[Agent, Team, Workflow, or custom loop]
  A --> S[Controlled model and tool services]
  S --> R
  R --> O[Events, result, and session state]
```

| Piece | Responsibility | Start here |
| - | - | - |
| Definition | Describes abilities, Agent defaults, limits, and optional runtime bindings | [Definitions](/harness/definitions) |
| Ability | Binds tools, prompt fragments, context sources, or middleware for one run | [Context and tools](/harness/context) |
| Runtime | Enforces grants and budgets, acquires a session, settles one result, and cleans up | [Run lifecycle](/harness/runtime) |
| Driver | Adapts an executor to the runtime's controlled services | [Drivers](/harness/drivers) |
| Policies | Choose the next step, project model context, and accept or revise an answer | [Controllers and policies](/harness/policies) |
| Manifest | Serializes a definition using approved, versioned host factories | [Portable manifests](/harness/manifests) |
| Watch | Runs a bounded source-to-notification lifecycle using durable host services | [Durable watches](/harness/watches) |

## Build a complete application

<Columns cols={3}>
  <Card title="Research with a tool" icon="magnifying-glass" href="/examples/harness-research">Combine source context, a lookup tool, grants, budgets, and streamed events.</Card>
  <Card title="Continue a conversation" icon="comments" href="/examples/harness-sessions">Reuse history, inspect snapshots, isolate users, and release sessions.</Card>
  <Card title="Review workspace files" icon="folder-open" href="/examples/harness-workspace">Give a run explicit file context and clean up an owned workspace.</Card>
</Columns>

Each recipe includes installation, a complete source file, a run command, expected output, and failure handling. See [examples](/examples/overview) for the other application paths.

## Choose the right entrypoint

Use `@agentium/harness` for the runtime, abilities, drivers, policies, manifests, and watches. Use `@agentium/harness/testing` for `testDriverContract`.

You can still use a plain `Agent` directly when its own run loop is all you need. Core consumes the neutral `ExecutionServices` interface; it does not construct a harness. See [migrating to the package](/harness/migration) if you previously used Agent-owned harness configuration.

## What the host owns

Your application authenticates callers, supplies identity and grants, connects services, and chooses model providers. An identity field scopes state; it does not authenticate a request. Custom abilities and drivers are trusted application code.

`HarnessRuntime` currently executes locally. Its default sessions, event history, and artifacts are in memory. It does not resume interrupted model runs after a process restart. `DurableWatch` is a separate lifecycle with explicit durable store, scheduler, and notification connector requirements.

Continue with the [quickstart](/harness/quickstart), or use the [troubleshooting and testing guide](/harness/testing) while integrating a custom driver.


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