Metadata-Version: 2.5
Name: harnessweaver
Version: 0.18.0
Summary: The composable AI harness framework. Weave your own AI harness: bring your models, choose your plugins, define your execution.
Author-email: Muthu Kumaran R <rsmk7new@gmail.com>
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: agents,ai,governance,guardrails,harness,llm,observability
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: anyio>=4.7
Requires-Dist: loguru>=0.7.3
Requires-Dist: opentelemetry-api>=1.30
Requires-Dist: pydantic>=2.12
Requires-Dist: pyyaml>=6.0.2
Provides-Extra: all
Requires-Dist: harnessweaver-anthropic>=0.1.0; extra == 'all'
Requires-Dist: harnessweaver-cel>=0.1.0; extra == 'all'
Requires-Dist: harnessweaver-cli>=0.1.0; extra == 'all'
Requires-Dist: harnessweaver-monty>=0.1.0; extra == 'all'
Requires-Dist: harnessweaver-openai>=0.1.0; extra == 'all'
Requires-Dist: harnessweaver-otel>=0.1.0; extra == 'all'
Requires-Dist: harnessweaver-pydantic-ai>=0.1.0; extra == 'all'
Requires-Dist: harnessweaver-sidecar>=0.1.0; extra == 'all'
Provides-Extra: anthropic
Requires-Dist: harnessweaver-anthropic>=0.1.0; extra == 'anthropic'
Provides-Extra: cel
Requires-Dist: harnessweaver-cel>=0.1.0; extra == 'cel'
Provides-Extra: cli
Requires-Dist: harnessweaver-cli>=0.1.0; extra == 'cli'
Provides-Extra: monty
Requires-Dist: harnessweaver-monty>=0.1.0; extra == 'monty'
Provides-Extra: openai
Requires-Dist: harnessweaver-openai>=0.1.0; extra == 'openai'
Provides-Extra: otel
Requires-Dist: harnessweaver-otel>=0.1.0; extra == 'otel'
Provides-Extra: pydantic-ai
Requires-Dist: harnessweaver-pydantic-ai>=0.1.0; extra == 'pydantic-ai'
Provides-Extra: sidecar
Requires-Dist: harnessweaver-sidecar>=0.1.0; extra == 'sidecar'
Description-Content-Type: text/markdown

# harnessweaver

The core of [HarnessWeaver](https://github.com/Wise-DreamerZ/HarnessWeaver), *the composable AI harness framework*: the spec loader, the 13-point hook bus, envelope and budgets, the error taxonomy, the runners, the built-in modules and the test kit. It depends only on `pydantic`, `opentelemetry-api`, `pyyaml`, `anyio` and `loguru`.

```bash
uv add harnessweaver                 # the core
uv add "harnessweaver[openai]"       # plus a first-party plugin
uv add "harnessweaver[all]"          # every first-party plugin, the CLI and the sidecar
```

```python
import harnessweaver as hw

harness = hw.load("harness.yaml")        # spec + org baseline + env overlay, validated at startup

# Wrap: govern a client the app already has
client = harness.instrument(AsyncOpenAI(base_url=GATEWAY))

# Session: your code owns the flow, the harness governs each step
async with harness.session("support", principal=user, tenant="acme") as s:
    route = await s.decide("intent", text=question)
    articles = await s.context("help").fetch(question)
    answer = await s.generate(prompt="answer@1", question=question, intent=route.choice)

# Run: the harness owns the lifecycle
result = await harness.run("extract_invoice", doc, principal=user)
```

| Extra | Adds |
| --- | --- |
| `openai` | `openai.chat` for any OpenAI-compatible endpoint, and `instrument()` for OpenAI clients |
| `anthropic` | `anthropic.messages` for Claude, and `instrument()` for Anthropic clients |
| `pydantic-ai` | The `pydantic_ai.agent` runner and `wrap()` for Pydantic AI agents |
| `monty` | `monty.sandbox` for code-executing tools |
| `otel` | `otel.sdk`: OpenTelemetry SDK and exporter setup |
| `cel` | `cel.policy`: full CEL for policy rules |
| `cli` | The `harnessweaver` command |
| `sidecar` | `harnessd`, the HTTP sidecar |
| `all` | All of the above |

The test kit is `harnessweaver.testing`, and installing the package adds the plugin conformance suite to pytest (`pytest --harnessweaver-conformance=<namespace>`).

Documentation: [the docs](https://github.com/Wise-DreamerZ/HarnessWeaver/blob/main/docs/index.md), from [Concepts](https://github.com/Wise-DreamerZ/HarnessWeaver/blob/main/docs/concepts/index.md) to the [spec reference](https://github.com/Wise-DreamerZ/HarnessWeaver/blob/main/docs/reference/spec.md).
