Earned autonomy for the OpenAI Agents SDK — warrantd drives the approval switch.
Project description
warrantd-openai-agents
Your framework has the approval switch; warrantd is the brain that flips it.
The OpenAI Agents SDK
already ships human-in-the-loop tool approval: needs_approval,
interruptions, approve/reject, resume. What it doesn't ship is a policy for
when a tool needs approval — that's usually a hardcoded bool.
This adapter makes the switch dynamic: earned autonomy from warrantd. A tool starts at MANUAL (every call interrupted for a human), earns SUPERVISED through clean approvals (auto-runs within a value cap), and is bounded by ceilings no metric can move.
pip install warrantd-openai-agents
Quickstart
from decimal import Decimal
from agents import Agent, Runner
from warrantd import (
ActionClass, ApprovalHistorySignal, AutonomyState, GraduationThresholds,
InMemoryApprovalHistory, RiskTier, TrustLayer, TrustPolicy,
)
from warrantd_openai_agents import ToolBinding, WarrantdGate
policy = TrustPolicy(
actions={"issue_refund": ActionClass(
name="issue_refund", risk=RiskTier.REVERSIBLE_WRITE,
auto_cap=Decimal("100"), hard_cap=Decimal("1000"),
max_state=AutonomyState.SUPERVISED,
)},
thresholds=GraduationThresholds(
pass_rate={AutonomyState.SUPERVISED: 1.0, AutonomyState.AUTONOMOUS: 1.0},
adversarial_pass_rate={AutonomyState.SUPERVISED: 0.0, AutonomyState.AUTONOMOUS: 0.9},
min_samples={AutonomyState.SUPERVISED: 5, AutonomyState.AUTONOMOUS: 1000},
),
)
evidence = InMemoryApprovalHistory()
trust = TrustLayer(policy, audit=my_audit_sink,
signals=[ApprovalHistorySignal(evidence, window=10)])
gate = WarrantdGate(trust, policy=policy, evidence=evidence,
bindings={"issue_refund": ToolBinding(value_param="amount")})
agent = gate.guard_agent(Agent(name="billing", tools=[issue_refund]))
result = await Runner.run(agent, "refund invoice INV-1 by $50")
if result.interruptions: # REQUIRE_APPROVAL: run paused
state = result.to_state()
for item in result.interruptions:
print(gate.context_for(item).sentence())
# -> "this class is 4/10 approvals from SUPERVISED — your decision
# feeds its trust record"
gate.approve(state, item, approver="alice") # or gate.reject(...)
result = await Runner.run(agent, state)
After enough clean approvals the same call stops interrupting — it
auto-runs within auto_cap. A call above hard_cap never interrupts either:
it is blocked outright, with the reason returned as tool output so the model
can adapt. Ceilings never move.
Call
gate.approve()/gate.reject(), notstate.approve()directly — the SDK has no approval callback, so the gate is the hook that turns the human's decision into trust evidence. Bypass it and nothing is learned.
What this adapter does NOT do
- No decision logic. Every verdict comes from
warrantd-core'sTrustLayer; this package only translates SDK events. (Verify it:GraduationEngineappears only in the display-only progress helper, and noDecision/Verdictis ever constructed here.) - No approval UI. Your interruption handler is the UI;
context_for()gives you the graduation sentence to render. - No MCP gating. For gating MCP servers with zero agent changes, use warrantd-gateway.
- No persistence by default.
InMemoryApprovalHistoryresets on restart. For hash-chained, restart-proof evidence:
pip install "warrantd-openai-agents[gateway]"
from warrantd_openai_agents.stores import sqlite_store
evidence = sqlite_store(".warrantd/evidence.db") # also usable as audit=
That store is the gateway's chained audit log: warrantd verify-audit
checks it and warrantd dashboard displays it read-only.
Learn more
- Why earned autonomy:
DESIGN.md— Trust is earned, not configured - Runnable example (no API key needed):
examples/openai_agents/earned_autonomy.py - API promises:
STABILITY.md
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 warrantd_openai_agents-0.1.0.tar.gz.
File metadata
- Download URL: warrantd_openai_agents-0.1.0.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
537a4920d5ff5fda5e201c782cc78b3e9f3853ebddb01382c93c65482ec2b1eb
|
|
| MD5 |
f09ef2e4c0ba000772abf577714387c2
|
|
| BLAKE2b-256 |
5582649a99cec80c11a5ef54aaaf41b74dc0be653cd27130cf525d1f5bf51541
|
Provenance
The following attestation bundles were made for warrantd_openai_agents-0.1.0.tar.gz:
Publisher:
release.yml on moritzkazooba-wq/warrantd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
warrantd_openai_agents-0.1.0.tar.gz -
Subject digest:
537a4920d5ff5fda5e201c782cc78b3e9f3853ebddb01382c93c65482ec2b1eb - Sigstore transparency entry: 1797620698
- Sigstore integration time:
-
Permalink:
moritzkazooba-wq/warrantd@d40723bc41b5b02ee0f3f6b6580aceadad1ff18f -
Branch / Tag:
refs/tags/warrantd-openai-agents-v0.1.0 - Owner: https://github.com/moritzkazooba-wq
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d40723bc41b5b02ee0f3f6b6580aceadad1ff18f -
Trigger Event:
release
-
Statement type:
File details
Details for the file warrantd_openai_agents-0.1.0-py3-none-any.whl.
File metadata
- Download URL: warrantd_openai_agents-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.0 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 |
9a70cd5f12ed9d02e7ea06d5a14958eadf6f21c0ba141a415d3e9de501a97145
|
|
| MD5 |
d67003c803a621a052dbdafd0a205cb2
|
|
| BLAKE2b-256 |
ab32f61e3fca9e60a58bd1cccfad26fab63f4a902f66f945361d0508d1809353
|
Provenance
The following attestation bundles were made for warrantd_openai_agents-0.1.0-py3-none-any.whl:
Publisher:
release.yml on moritzkazooba-wq/warrantd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
warrantd_openai_agents-0.1.0-py3-none-any.whl -
Subject digest:
9a70cd5f12ed9d02e7ea06d5a14958eadf6f21c0ba141a415d3e9de501a97145 - Sigstore transparency entry: 1797620919
- Sigstore integration time:
-
Permalink:
moritzkazooba-wq/warrantd@d40723bc41b5b02ee0f3f6b6580aceadad1ff18f -
Branch / Tag:
refs/tags/warrantd-openai-agents-v0.1.0 - Owner: https://github.com/moritzkazooba-wq
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d40723bc41b5b02ee0f3f6b6580aceadad1ff18f -
Trigger Event:
release
-
Statement type: