agenomic-python
Python SDK for Agenomic — agent-native versioning, tracing, and ATEP signed event logs.
Works fully offline. Cloud upload is optional.
Install
pip install agenomic
Optional integrations:
pip install "agenomic[openai]" # OpenAI auto-instrumentation
pip install "agenomic[anthropic]" # Anthropic auto-instrumentation
pip install "agenomic[huggingface]" # Hugging Face Hub + Inference
pip install "agenomic[langgraph]" # LangGraph state-graph tracing
pip install "agenomic[all]" # Everything
Quickstart
from agenomic.trace.decorator import trace_agent_run
from agenomic.exporters.jsonl import JsonlExporter
with JsonlExporter("traces.jsonl") as exporter:
@trace_agent_run(agent_id="agent://acme/demo", exporter=exporter)
def handle(query: str) -> dict:
return {"answer": query.upper()}
handle("hello")
That writes a signed-ready TraceEnvelope to traces.jsonl. No network. No
account required.
What's in the box
@trace_agent_rundecorator (sync + async) with contextvar-based propagationTraceEnvelopepydantic v2 models compatible withagenomic-specWorkflowSpec/SystemSpecpydantic v2 models for the v0.2 workflow and multi-agent system manifests (RFC 0009), with step-graph and role checks- ATEP segment writer/reader with BLAKE3 causal hashes and ed25519 signatures
- Boundary redaction (REMOVE / MASK / HASH / TRUNCATE) with dotted paths
- Exporters: JSONL, ATEP local, HTTP batched, multi fan-out
- Optional, lazy-imported integrations: OpenAI, Anthropic, LangGraph, MCP
- Async-first cloud client with idempotency keys + retry
Documentation
Full index at docs/.
- Quickstart · API reference
- Tracing · Decorator · Exporters
- Canonical v0.3 runs · Online tracking · RMP
- ATEP · Keys & signing · Redaction
- Integrations · Cloud upload
- Workflow & system manifests
- Hugging Face provider
- CLI · Errors
- Non-determinism disclaimer
Using an AI coding agent (Claude Code, Cursor, Copilot)? Point it at
AGENT.md — a condensed SDK guide written for agents:
import maps, canonical recipes, and pitfalls.
Tool execution for replays (Tool Gateway and Tool Mock Engine)
In cloud mode, client.tools routes each tool call of a replay to a real
backend (credentials resolved server-side from ${env:VAR_NAME} references)
or to the Tool Mock Engine, chosen per tool by an explicit configuration.
Nothing falls back to a real call: an unknown tool or a missing fixture is an
error.
from agenomic import Client
from agenomic.tools import ToolCallError
tools = Client(api_key="agm_...", base_url="https://cloud.example").tools
plan = tools.preflight(config_text=open("tool_execution.yaml").read(), repetitions=3)
run = tools.create_run(name="hybrid", config_text=open("tool_execution.yaml").read(), repetitions=3)
if run["status"] == "planned":
run = tools.approve_run(run["id"], plan_hash=run["plan_hash"])
tools.start_run(run["id"])
router = tools.router(run["id"], repetition=1)
customer = router.call("crm.get_customer", {"id": "c_1"}) # live or mock, per binding
try:
router.call("email.send", {"to": "ops@example.test"})
except ToolCallError as error:
print(error.code, error.envelope.provenance)
print(router.summary()) # {'calls': 2, 'by_source': {...}, 'has_real_calls': ..., 'unreported': 0}
tools.complete_run(run["id"])
Functions passed as local_functions never run before the engine allows
them: the router calls local/authorize first (budget reserved, pending
record), executes only on a local decision that carries a record id,
routes the call through the engine when the run binds the tool to a mock,
and settles the record with report-local. If the report fails, the call
stays in router.calls with reported=False and
external_state="indeterminate". router.calls holds typed
ToolCallResult models (result, status, provenance, external_state).
Local mode (Client() without base_url) runs an in-process engine with the
same statuses and refusals: validation, preflight, run lifecycle with
approval, the static, rules and recorded strategies and local
functions through the same two-phase protocol. What needs the gateway
(mcp and http adapters, scenario, schema_generated and plugin
strategies, connection tests) is refused by the plan with an explicit
error; neither mode falls back to the other.
For asyncio runtimes use tools.arouter(run_id) (local functions may be
coroutines) or tools.ainvoke(...): the per-call path awaits an async HTTP
client so the event loop is never blocked by a gateway round-trip. The
administrative methods (profiles, contracts, fixtures, runs) stay
synchronous.
See examples/10_tool_execution.py and the cloud documentation
docs/tool-execution.md.
Protect: policy enforcement
A run whose configuration carries a protect block is admitted call by
call by the cloud gateway. The router applies the decision and never
executes what was not admitted: a call waiting for a human approval raises
ToolApprovalPending (code approval_pending), a refused call raises
ToolCallDenied (code policy_denied), an unknown decision string is
treated as denied. Both land in router.calls with status pending or
denied and carry the gateway protect decision.
from agenomic.tools import ToolApprovalPending, ToolCallDenied
router = tools.router(run["id"], before_action=lambda identity: audit(identity))
try:
router.call("payments.refund", {"amount_minor": 90000, "currency": "EUR"})
except ToolApprovalPending as pending:
# re-issues the same call once approved
router.resume(pending, poll_interval=2.0, timeout=900.0)
except ToolCallDenied as denied:
print(denied.code, denied.envelope.safe_explanation)
resume polls the approval and raises ToolCallDenied with the approval
status as code when it is rejected or expired; an approval already
consumed is re-issued once with the original idempotency key, which
recovers the stored result, or raises
ToolExecutionError("conflict", ..., 409) when the gateway answers 409.
before_action runs with
the call identity before any request and aborts the call when it raises.
Local functions forward the signed permit of a Protect run to
report-local. Model calls are covered cooperatively: inject the run
overlay with instrument_openai(client, overlay=client.protect.overlay(run_id))
(first system message) or instrument_anthropic(client, overlay=...)
(system prompt). client.protect exposes approvals, decisions, policies,
bindings, restrictions, the kill switch, simulation and the coverage
matrix. The local engine refuses protect configurations
(protect_cloud_required): policies are evaluated by the gateway only. See
docs/protect.md.
Examples
See examples/ — minimal trace, decorator + JSONL, ATEP local,
OpenAI traced, LangGraph traced, cloud upload, and a full offline signed
release.
License
Apache-2.0. See LICENSE.
Metadata
Release files for agenomic 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| agenomic-0.1.3.tar.gz | 384.5 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agenomic-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 509.2 kB
Release files / agenomic-0.1.3.tar.gz
| Download URL | agenomic-0.1.3.tar.gz |
|---|---|
| Size | 384.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
49121baa3774a4dbfaa01d4e15a281de3de44569e3332d0028ef6ef5ad059d31
|
|
BLAKE2b-256 checksum How to use checksums |
709e1d23239158b9c09d5342da5c1e581c5a5ff1aeac0ac2795c11f4a9d9cf95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.
Transparency logRelease files / agenomic-0.1.3-py3-none-any.whl
| Download URL | agenomic-0.1.3-py3-none-any.whl |
|---|---|
| Size | 124.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9f85d92f28c11e39978b4d8f53253dc917e87b80583978ad92354d8e6d23f6f2
|
|
BLAKE2b-256 checksum How to use checksums |
c48f823f911f4d77af14355708423409df501749ac2bea689584afba9f656bc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.
Transparency logSecurity for agenomic 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for agenomic-0.1.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.