Governed execution trees for AI agents: budget it, gate it, replay it.
Project description
pollard
Governed execution trees for AI agents: budget it, gate it, replay it.
pip install pollard
from pollard import Budget, Runtime
from examples.mock_model import call_model
rt = Runtime("runs.db")
with rt.run("triage", budget=Budget(tokens=120_000, depth=8)) as run:
node = run.model_call(
{"model": "mock-1", "messages": [{"role": "user", "content": "Summarize: ..."}]},
fn=call_model,
)
print(node.result["text"])
print(run.report())
pollard is a runtime primitive, not an agent framework. It records each step as a node in a content-addressed tree. Node identity is a hash of the step inputs, parent identity, kind, and attempt number, so the tree gives you a control-flow ledger without owning your model client, tools, prompts, or loop.
What you get:
- Budget: refuse a step before it runs when a known budget would be exceeded.
- Branch and rollback: make alternate children, move the cursor back, and keep shared history.
- Audit: each node id commits to its ancestry and identity payload.
- Replay-ready records: results live at nodes, separate from node identity, for later record/replay work.
Budget semantics are honest about what can be controlled. If a precheck estimate proves a step would exceed budget, pollard records a refusal node and does not call your function. If the actual result charge exceeds budget after the function returns, that node still stands because the spend already happened; later steps are refused.
Limits in v0.1:
- Replay of sampled model calls is not included until v0.3.
- Hosted API energy use is not measured. The NVML energy meter is for local GPU inference only.
- A SQLite store assumes one writer process.
- The audit tree is tamper-evident, not tamper-proof. Verification detects changed history, but it cannot stop deletion of the whole store file.
How it compares:
- LangGraph and related graph runtimes execute a graph you author ahead of time. pollard ledgers the control flow your code performs and can wrap calls inside a graph node.
- pydantic-ai, smolagents, and the OpenAI Agents SDK own more of the agent loop. pollard is bring-your-own-client and has zero core runtime dependencies.
- Action firewall products judge tool calls by content policy. pollard v0.2 will add structural registry gating: an action resolves against a versioned registry or it does not execute.
- HTTP recorders pin transport bytes. pollard pins semantic steps, so recordings can outlive SDK or provider changes.
See examples/ for offline scripts that run without network access.
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 pollard-0.1.0.tar.gz.
File metadata
- Download URL: pollard-0.1.0.tar.gz
- Upload date:
- Size: 21.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5083af5ac54ec80fa330a44b31c6cbafffdc02a2580e340e41381846e5ebb23a
|
|
| MD5 |
b1705fc48c29ab18adf30d21d50fd3d2
|
|
| BLAKE2b-256 |
935c9c8ac306fcebef371614b2be3b2752295416d2cead5fb14f88f0b6e86909
|
File details
Details for the file pollard-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pollard-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
627e8f27aeb7e06274a8611cfe0835b08f9e029980ed66cb75e1d93eb4b69d63
|
|
| MD5 |
2865b6915adbb2db724fc8b44a19a2f7
|
|
| BLAKE2b-256 |
ab3d3ee9640e83f5cc4c4b72430e55ded6ede70082e4e4636bfbbd5bdfede077
|