Observability-first agent harness: every session is a structured, deterministically replayable trace.
Project description
regista
The agent harness with a flight recorder.
regista is an observability-first agent harness for Python: the runtime layer that turns a stateless LLM API into an agent that can act. Every session is recorded as a structured, append-only trace — complete enough to deterministically replay the entire session with zero API calls and zero cost.
regista (Italian): the deep-lying playmaker who directs the game. Also: "director."
pip install regista-harness # the import name is `regista`
Status: v0.2 released; v0.3 feature-complete on main. Loop, tools, environment,
policy, Anthropic + OpenAI-compatible providers, streaming, compaction, deterministic
replay, OTel export, Agent.resume, MCP client, eval/regression runner — plus v0.3's
subagents, Skills, and ContainerEnvironment. 180+ tests, strict mypy, every subsystem
traced.
Why another harness?
Every serious agent harness treats observability as an add-on or a paid platform. regista treats the trace as the product:
- 🔍 Structured event log — every LLM call, tool execution, permission decision, token count, and dollar of cost, as typed JSONL events. If a behavior isn't in the trace, it's a bug.
- ⏪ Deterministic replay — re-run any recorded session with the LLM and tools served from the recording: hermetic, keyless, $0. Strict mode hash-verifies every request and fails with a structural diff — zero-cost regression tests for CI.
- 📊 OpenTelemetry export — the same trace as session/turn/llm/tool spans in Jaeger/Grafana, post-hoc, with the recorded timestamps.
- 🔌 Provider-neutral — native Anthropic adapter plus an OpenAI-compatible adapter (OpenAI, Ollama, vLLM, gateways). Streaming on both.
- 🛡️ Permission gate — Allow/Deny/Ask policies on every tool call, workspace-scoped execution, honestly documented as a gate (not a sandbox).
A coding agent in ~30 lines
import asyncio
from regista import Agent
from regista.environment import LocalEnvironment
from regista.policy import PermissionRequest, workspace
from regista.providers import AnthropicProvider
from regista.tools.builtin import builtin_tools
env = LocalEnvironment("./sandbox") # every file op is pinned here
async def approve(request: PermissionRequest) -> bool:
return input(f"allow {request.tool_input}? [y/N] ") == "y"
agent = Agent(
provider=AnthropicProvider("claude-sonnet-4-6"), # the model is always explicit
instructions="You are a careful coding agent. Run the tests after every change.",
tools=builtin_tools(env), # read/write/list/glob/search/shell/fetch
policy=workspace(), # file tools allowed; shell escalates to Ask
ask_handler=approve,
max_turns=30,
max_cost_usd=1.00, # hard budget, from provider-reported usage
)
result = asyncio.run(agent.run("pytest is failing in this repo — find the bug and fix it"))
print(result.output, f"${result.cost_usd:.2f}", result.trace_path)
The same Agent streams: async for event in agent.stream(task) yields text deltas, tool
start/finish, and per-turn usage as they happen — and writes the identical trace.
The flight recorder
Every run writes a JSONL trace: session.start, llm.request (with a SHA-256
request_hash), llm.response, tool.call, permission.decision, tool.result,
context.compaction, session.end. That log is complete enough to re-run the session:
from regista import replay
replayed = await replay(result.trace_path) # no API key, no network, no side effects
assert replayed.cost_usd == 0.0
assert replayed.output == result.output
Replay is hash-verified call by call. Change anything that shaped a request — the prompt, a tool schema, a sampling param — and strict mode fails with a diff pointing at exactly what drifted:
ReplayDivergence: request 1 diverged from the recording (trace seq 1)
request.system: recorded 'You are a greeter.' != live 'You are a greeter. Always answer in French.'
mode="warn" keeps serving positionally for time-travel debugging; mode="hybrid" falls
through to a live provider mid-session. agent.resume(trace_path) packages that: the
recorded prefix replays for $0 (tool effects never re-run), and the session continues live
from wherever the crash left it.
Zero-cost testing
FakeProvider is public API. Script the model, run the real loop, assert on the real trace:
from regista.providers import FakeProvider, text_response, tool_use_response
provider = FakeProvider([
tool_use_response(("tu_1", "greet", {"name": "world"})),
text_response("done"),
])
~90% of regista's own test suite runs on it — and your agent's tests can too. Committed traces replayed strictly in CI are your end-to-end tests, forever, for free.
regista.evals packages that into a regression runner: an EvalSuite of tasks with
checks on outcome and trace shape (output_contains, tool_never_called("shell"),
max_cost_usd(0.50), …). suite.record(agent) saves passing runs as fixtures;
suite.replay() re-judges them in CI at $0, with any divergence from the recording
failing the task.
Architecture
regista is organized around nine harness primitives — instructions, context management, tool interface, execution environment, durable state, orchestration, subagents, skills, verification & observability — each mapping 1:1 to a module with one interface. ARCHITECTURE.md explains the whole system from first principles, including the dependency diagram and the life of a request; it's written for people who have never built an agent.
Try it
On PyPI the distribution is named regista-harness (the bare name was squatted);
the import name is regista everywhere. From source:
git clone https://github.com/mohakwagh/regista && cd regista
uv sync
uv run python examples/01_hello_agent.py # $0: scripted model, real loop, real trace
uv run python examples/05_replay.py # $0: replay + a divergence diff
uv run --extra mcp python examples/06_mcp.py # $0: MCP tools, replayed with the server off
ANTHROPIC_API_KEY=... uv run python examples/04_real_provider.py # ~1 cent
Roadmap
- v0.2 — all on main:
Agent.resume()· MCP client · eval/regression runner (replay-powered $0 CI) - v0.3 — all on main: subagents (
Agent.as_tool) · Skills ·ContainerEnvironment
Safety, honestly
The permission layer is a policy gate, not a sandbox: an allowed shell command can do
anything your user account can. The environment scopes paths (symlinks included), strips
secrets from subprocess env, and enforces timeouts — and every decision is in the trace.
For untrusted tasks, ContainerEnvironment runs commands inside Docker with a one-line
swap. SECURITY.md has the full threat model.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file regista_harness-0.3.0.tar.gz.
File metadata
- Download URL: regista_harness-0.3.0.tar.gz
- Upload date:
- Size: 243.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd5fff76308454aaca827ea27b75725415558da7e5d997856b996cfcb7ea6a0b
|
|
| MD5 |
31a3db4810983e79d4879e9c4add3413
|
|
| BLAKE2b-256 |
dd3e4538c3f0552b56abd306b3754f5c22ab3f99bae08e46261efd221054c12c
|
Provenance
The following attestation bundles were made for regista_harness-0.3.0.tar.gz:
Publisher:
release.yml on mohakwagh/regista
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
regista_harness-0.3.0.tar.gz -
Subject digest:
fd5fff76308454aaca827ea27b75725415558da7e5d997856b996cfcb7ea6a0b - Sigstore transparency entry: 2121684204
- Sigstore integration time:
-
Permalink:
mohakwagh/regista@0d30ca650ef5b461ad57286157d75b152a54ceb9 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/mohakwagh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0d30ca650ef5b461ad57286157d75b152a54ceb9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file regista_harness-0.3.0-py3-none-any.whl.
File metadata
- Download URL: regista_harness-0.3.0-py3-none-any.whl
- Upload date:
- Size: 67.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6431e493a517557ab44f783bcf6e783f62f2f6814a20a2429fd72bbd363ad241
|
|
| MD5 |
31d9a07a23f1af507014d00a9ea229be
|
|
| BLAKE2b-256 |
dcb996dfd1fbd7b00777771f6e6e454128a7448444ae6b66c1fde0b5eda308bc
|
Provenance
The following attestation bundles were made for regista_harness-0.3.0-py3-none-any.whl:
Publisher:
release.yml on mohakwagh/regista
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
regista_harness-0.3.0-py3-none-any.whl -
Subject digest:
6431e493a517557ab44f783bcf6e783f62f2f6814a20a2429fd72bbd363ad241 - Sigstore transparency entry: 2121684252
- Sigstore integration time:
-
Permalink:
mohakwagh/regista@0d30ca650ef5b461ad57286157d75b152a54ceb9 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/mohakwagh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0d30ca650ef5b461ad57286157d75b152a54ceb9 -
Trigger Event:
push
-
Statement type: