Metadata-Version: 2.5
Name: a13n-harness
Version: 0.4.0
Summary: Process-local agent harness built on Pydantic AI
License-Expression: Apache-2.0
License-File: LICENSE
Requires-Python: >=3.13
Requires-Dist: a13n-envd-client<0.2.0,>=0.1.0
Requires-Dist: a13n-logging<0.3.0,>=0.2.0
Requires-Dist: anthropic<2,>=1.3
Requires-Dist: anyio<5,>=4
Requires-Dist: botocore<1.43.57,>=1.43.3
Requires-Dist: filelock<4,>=3.18
Requires-Dist: genai-prices<1,>=0.1.9
Requires-Dist: google-auth<3,>=2.40
Requires-Dist: google-genai<3,>=1.0
Requires-Dist: httpx2<3,>=2.5
Requires-Dist: jsonschema<5,>=4.25
Requires-Dist: openai<4,>=3.5
Requires-Dist: opentelemetry-api<2,>=1.39
Requires-Dist: pathspec<2,>=1.1
Requires-Dist: pydantic-ai[bedrock,bedrock-mantle,cohere,google-realtime,groq,huggingface,mistral,openai-realtime,openrouter,retries,typesafe,xai,xai-realtime]<3,>=2.51.0
Requires-Dist: pydantic-core<3,>=2.41
Requires-Dist: pydantic-monty<2,>=1.0.0
Requires-Dist: pydantic<3,>=2.12
Requires-Dist: pyjwt[crypto]<3,>=2.10
Requires-Dist: pyyaml<7,>=6.0
Requires-Dist: referencing<1,>=0.37
Requires-Dist: tenacity<10,>=9
Requires-Dist: typesafe-sdk<1,>=0.7.1
Requires-Dist: typing-extensions<5,>=4.15
Requires-Dist: websockets<16,>=15
Provides-Extra: docker
Requires-Dist: docker<8,>=7.2; extra == 'docker'
Provides-Extra: e2b
Requires-Dist: e2b<3,>=2.46.4; extra == 'e2b'
Provides-Extra: modal
Requires-Dist: modal<2,>=1.5.5; extra == 'modal'
Description-Content-Type: text/markdown

# Agent Harness

Harness (`a13n-harness`) is the embeddable execution SDK behind [Harness UI](../a13n-harness-ui/README.md) and [Service](../a13n-service/README.md). It builds reusable agents, runs them with current tools and Environments, streams observations, and returns state for continuation. Start with the [offline quickstart](../../docs/a13n-harness/getting-started.md); the Python import is `a13n_harness`.

## Capability composition

Build an `AgentSpec` with only the behavior your application needs. For example, to expose Environment tools and working state:

```python
from a13n_harness import AgentSpec, HarnessBuilder
from a13n_harness.capabilities import WorkingStateCapability
from a13n_harness.environment import DynamicEnvironmentCapability, DynamicEnvironmentConfiguration

executable = HarnessBuilder().build(
    AgentSpec(model="openai-responses:gpt-5"),
    output_type=str,
    capabilities=(
        DynamicEnvironmentCapability(DynamicEnvironmentConfiguration()),
        WorkingStateCapability(),
    ),
)
```

Supply a fresh Provider `Environment` to each `run(..., environment=...)`, or use `environments={...}` for named mounts. Harness enters and closes adapters; your application selects their configuration, current state, access policy, and when to destroy a backing target. See [Environments](../../docs/a13n-harness/environments.md) and [Capabilities](../../docs/a13n-harness/capabilities.md).

## Model construction

Pass a native model directly through `HarnessBuilder.build(model=...)`, or select one in `AgentSpec.model`. `a13n_harness.infer_model()` constructs a model from supported aliases and caller-owned provider factories. `create_model_http_client()` builds a caller-owned `httpx2` client for provider requests. Configure credentials and close owned clients in your application. See [Models](../../docs/a13n-harness/models.md) and [Model authentication](../../docs/a13n-harness/model-authentication.md).

## Execution boundary and filters

Each built Agent includes the tool execution boundary and message integrity filter. Add Capabilities for policy, context, memory, delegation, or model recovery. Toolsets are available from `a13n_harness.toolsets`, and managed tool contracts from `a13n_harness.tools`.

A completed Run returns a `HarnessState` with a stable `thread_id`. Pass it as `previous_state` to continue the Thread; each new Run receives a fresh `run_id`. The Host persists accepted state and reconstructs credentials and other current authority on resume. [State and resume](../../docs/a13n-harness/state-and-resume.md) covers serialization and interrupted calls.

## Runnable examples and guides

- [Agent application](../../examples/agent-app/README.md): offline streaming turns, checkpointing, and restart recovery.
- [Environment Providers](../../examples/environment-provider/README.md): construction, re-entry, and lifecycle.
- [Plugins and extensions](../../examples/plugins/README.md): packaged middleware, Capabilities, and Environment integrations.
- [Harness guide](../../docs/a13n-harness/index.md): the public API by task.

## Versioning

Harness and `a13n-stream-protocol` publish together at one exact version. Harness UI releases independently. The [Harness specification](../../spec/a13n-harness/README.md) owns the accepted contracts.
