Skip to main content

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."

Status: pre-release. The v0.1 core is feature-complete — loop, tools, environment, policy, both providers, streaming, compaction, replay, OTel export — with 140+ tests, strict mypy, and every subsystem traced. Docs site and the PyPI release are landing next.

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 — which is how a crashed trace resumes.

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.

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
ANTHROPIC_API_KEY=... uv run python examples/04_real_provider.py   # ~1 cent

Roadmap

  • v0.2 — eval/regression runner (replay-powered $0 CI) · MCP client · Session.resume()
  • v0.3 — subagents · 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, run the process in a container. SECURITY.md has the full threat model.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

regista_harness-0.1.0.tar.gz (176.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

regista_harness-0.1.0-py3-none-any.whl (55.4 kB view details)

Uploaded Python 3

File details

Details for the file regista_harness-0.1.0.tar.gz.

File metadata

  • Download URL: regista_harness-0.1.0.tar.gz
  • Upload date:
  • Size: 176.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for regista_harness-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dd6371a2636896e500f84a56b9aa62c45d412c25f03db20719f02b150252ce8e
MD5 306a649aa352d79f364d722ec3592fa1
BLAKE2b-256 ba1ad840e9da682c43a6f3b1f5c4ce9c9a569d71b5cb2775bbc9e4dbe1e9dd1c

See more details on using hashes here.

Provenance

The following attestation bundles were made for regista_harness-0.1.0.tar.gz:

Publisher: release.yml on mohakwagh/regista

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file regista_harness-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for regista_harness-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e31f2f4aac4ba423824c13f11f1d9ed6a7e9451b74ecf3381876c0127b67af47
MD5 33cf66625510dec58d71efcf5253723f
BLAKE2b-256 96698260f69ccc8c1982e16c02dda5154a78064728628a608cddb04f59b831ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for regista_harness-0.1.0-py3-none-any.whl:

Publisher: release.yml on mohakwagh/regista

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page