# @purista/harness

> Self-hosted enterprise agent harness for typed tools, agents, workflows, state, sandboxing, and telemetry.

Latest version **2.1.1** (published 2026-08-19) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @purista/harness
pnpm add @purista/harness
yarn add @purista/harness
bun add @purista/harness
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.1.1 |
| Published | 2026-08-19 |
| First published | 2026-05-06 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=24.15.0 |
| Dependencies | 3 |
| Unpacked size | 833.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 5 |
| Maintainers | sebastianwessel |

## Links

- npm: https://www.npmjs.com/package/@purista/harness
- Repository: https://github.com/puristajs/harness
- Homepage: https://github.com/puristajs/harness#readme
- Issues: https://github.com/puristajs/harness/issues
- npm.io page: https://npm.io/package/@purista/harness

## Dependencies (3)

- [zod](https://npm.io/package/zod.md) ^4.4.3
- [yaml](https://npm.io/package/yaml.md) ^2.9.0
- [@opentelemetry/semantic-conventions](https://npm.io/package/@opentelemetry/semantic-conventions.md) ^1.43.0

## Recent versions

- 2.1.1 (latest) — 2026-08-19
- 2.1.0 — 2026-08-19
- 2.0.0 — 2026-08-18
- 1.7.3 — 2026-08-10
- 1.7.2 — 2026-08-05
- 1.7.1 — 2026-07-20
- 1.7.0 — 2026-07-03
- 1.6.0 — 2026-06-24
- 1.5.2 — 2026-06-21
- 1.5.1 — 2026-06-17
- 1.5.0 — 2026-06-12
- 1.2.6 — 2026-06-11
- 1.2.5 — 2026-06-11
- 1.2.4 — 2026-06-11
- 1.2.3 — 2026-06-10
- … 5 more at https://npm.io/package/@purista/harness/versions

## README

# @purista/harness

Self-hosted enterprise agent harness for typed tools, agents, workflows, state,
sandboxing, streaming, and OpenTelemetry instrumentation.

The core package also exports provider-neutral eval helpers:

- `evaluatePromptCandidates(...)` compares prompt candidates against a fixed
  item set and deterministic or custom scorers.
- `evaluateDeterministicScorer(...)` runs JSON Pointer based deterministic
  scorer definitions without provider calls. It is exported from the main
  package and re-exported from `@purista/harness/testing`.

Telemetry defaults to dual GenAI and OpenInference attributes with no content
capture. `InvokeOptions.traceparent` and `tracestate` accept inbound W3C Trace
Context so application traces can parent harness run spans.

Workflows can orchestrate typed child agents with `ctx.agents.<id>(input)`.
Child-agent calls are disabled until a workflow declares `delegation` or the
harness opts in with `defaults.delegation.enabled: true`. Opted-in workflows get
bounded fan-out, agent allowlists, per-agent model alias overrides, and
lineage-rich run events.

For explicit background work, a workflow can use
`ctx.childTasks.start('agent', input)`. Tasks own an isolated sandbox and
private history, are retrievable by their session owner through
`session.childTasks`, and queue under the configured delegation ceiling. Use
`{ mode: 'continuable' }` for a short in-process task conversation with
serialized `send(...)` turns and an explicit `close()`; durable/restart-safe
work belongs in an application queue/worker integration.

Tool-call governance is optional. Configure `.governance(...)` only when an
application needs policy-driven tool exposure, typed domain policies, approval
gates, shadow rollout, audit events, or an adapter to an external policy engine.

See [Evaluating Prompts](https://github.com/puristajs/harness/blob/main/docs/guides/evaluating-prompts.md)
for the execution model, scorer limits, and privacy behavior.

## Static modules and test utilities

Reuse local, typed configuration with a static module. Modules are imported
application code: they are not discovered, downloaded, or hot-reloaded.

```ts
import { defineHarness, defineHarnessModule } from '@purista/harness'

const provider = /* a configured ModelProvider */
const models = defineHarnessModule<{}>()('support.models', {
  register: (builder) => builder.models({
    support: { provider, model: 'gpt-5-mini', capabilities: ['object'] }
  })
})

const harness = defineHarness().use(models).agents({ /* ... */ }).build()
```

`harness.inspect().modules` contains ordered, data-only provenance. Definition
ids compose additively and duplicates fail early. `shutdown()` centrally closes
all configured closable resources exactly once.

For deterministic tests, `@purista/harness/testing` provides an explicit
sanitizer-based recorder, offline replay provider, and explicit diagnostic
invariant runner. These utilities are opt-in and never create production
traffic recording or persistent replay data.

## Install

```bash
npm install @purista/harness
```

Optional peer dependencies:

- `@modelcontextprotocol/client` enables MCP stdio/http tools.
- `just-bash` enables the exec-capable bash sandbox.
- `@opentelemetry/api` connects harness spans to an existing OpenTelemetry
  context.

## Package Format

This package is ESM-only and ships compiled JavaScript plus TypeScript
declarations from `dist/`. Source files, tests, source maps, and local configs
are not included in the published package.

---
_Source: https://npm.io/package/@purista/harness · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
