Repository navigation
Integrations OpenAI Agents
Stable: tested with
tests/adapter_contract.pyagainst the pinned library on every push to main and every pull request (what's stable).
tracekit.integrations.openai_agents.TracekitAgents gates the tools of an OpenAI Agents SDK (Python) agent. Before
each tool call it asks the Tracekit signer for a policy decision; after the tool runs it records the outcome. It works
with any object that implements the signer RPC (tracekit.signer.rpc_schema.SignerAPI), including
tracekit.testing.FakeSigner.
pip install tracekit-ai "openai-agents>=0.23.1,<0.24"Python 3.10 or newer (the SDK's own requirement).
from agents import Agent, Runner, function_tool
from tracekit.integrations.openai_agents import TracekitAgents
@function_tool
def transfer_funds(to: str, amount_cents: int) -> str:
"""Move money."""
...
run = signer.register_run({"request_id": "run-start-1", "agent": {"name": "billing-agent"}})
tk = TracekitAgents(signer, run)
agent = Agent(name="billing-agent", model="gpt-5", tools=[tk.tool(transfer_funds)])
result = await Runner.run(agent, "pay acct-42 $15", context={}, hooks=tk)- Wrap every tool with
tk.tool(...): a plain function, aFunctionTool, aShellToolwith a local executor, aLocalShellToolor anApplyPatchTool. The signer's policy decides approvals, so a tool's ownneeds_approvalis replaced. - Any run context works. A dict context also carries each approval's id as a hint; with your own object (a dataclass, a pydantic model) the signer finds the approval by the tool call id.
-
hooks=tkrecords each model response (below).
A resumed run (another process, after a restart) builds TracekitAgents with the same run_id and run_token.
| When | RPC | Sent |
|---|---|---|
| before the tool runs | decide |
tool_call_id, tool name, the arguments as the SDK decoded them (parsed); after a resume in another process, the model's raw string |
| right before it runs | approval_consume |
the same call, the arguments (for function tools the model's raw string), and the approval id the run state carries as a hint |
| after the tool runs | complete |
status ok or error, a sha256: commitment to the result (not the result), or the exception type and message |
| after each model response | model_event |
a sha256: commitment to the whole response output, every tool call in it (tool_uses; hosted ones as executed_by: provider), and token usage; with the signer's content vault on, the output items themselves as the record's body |
What the model said: with the content vault on (content: {retain: true} in signer.yaml; the dev signer keeps it),
each response's output items (reasoning summaries, sealed encrypted_content, messages, calls) are kept encrypted in
the vault, so tracekit analyze --v2 can check the reasoning and claims before and after each call
(findings). Reasoning summaries come back
only when the model is asked for them (reasoning.summary); with the vault off only the commitment is kept.
The signer classifies the tool and computes the args digest itself; nothing the adapter sends is trusted for that.
-
allow: the tool runs.
-
deny: the tool does not run. The model gets
Tool call blocked by policy: <rule ids>as the tool output and the run goes on. -
ask: the run stops with an interruption (
result.interruptions), and the adapter opens an approval in the signer. Save the run state, let a person decide in the signer, then resume:saved = result.to_state().to_string() # keep it in your database # ... a person approves or rejects in the signer (CLI, web) ... state = await RunState.from_string(agent, saved) waiting = await tk.apply_decisions(state) # approves or rejects each paused call as the signer says if not waiting: result = await Runner.run(agent, state, hooks=tk)
apply_decisionsis the one place approvals are applied: it reads them from the signer, not from the saved state. A rejected call reaches the model asTool call rejected in Tracekit.
The saved run state is not authenticated (the SDK says so), so it carries the approval id only as a hint, in
context["tracekit"]["approvals"]. The SDK does not call needs_approval again on resume; the adapter's tool input
guardrail asks the signer on every execution, with the model's raw arguments string. The call runs only if the
signer's approval for this exact call and these exact arguments was granted and not used before. Editing the saved
state (the arguments, the call id, the hint, or approving the call in the state directly) gets the call refused, and
the signer records why. Exceptions raised by a tool are recorded, then handled by the tool's own failure policy as
without Tracekit.
hooks=tk records each model response in on_llm_end, its reasoning items included, linked to the calls by
call_id. Ask for readable reasoning with ModelSettings(reasoning=Reasoning(summary="auto")). Which frameworks and providers return readable reasoning, and how to turn it on: reasoning.
-
Hosted tools (web search, file search, code interpreter, image generation, hosted MCP, a hosted
ShellTool),ComputerTooland handoffs run outside the hooks Tracekit can gate.tk.tool(...)refuses hosted tools with aTypeError. They appear only astool_usesin the signed model exchange recorded for each model response (T3: what the agent process reported, not checked by Tracekit). -
LocalShellToolandApplyPatchToolcannot wait for an approval: the SDK has no approval hook for the first and does not tell the editor the call id of the second, so anaskfor them is refused. Allow and deny work as above. - The SDK runs each tool call id once, so every call is attempt 0.
Generated from docs/ at v1.4.1. Edit the docs in the repository, not here.
Get started
- Quickstart: the v2 signer
- Quickstarts
- Quickstart: Claude Agent SDK
- Quickstart: a custom agent
- Quickstart: LangChain and LangGraph
- Quickstart: MCP client
- Quickstart: OpenAI Agents SDK
- Coding agents other than Claude Code
- tracekit doctor
- Walkthrough: Tracekit end to end
How it works
- How Tracekit works
- Overview
- The life of a tool call
- The evidence format
- Verification and assurance
- Witnesses and monitoring
- Policy
- Approvals
- Detection and containment
- Capture and completeness
- Custody
- Provenance and tracekit why
- Deployment and isolation
- Storage, durability and performance
- Integrations
- Security model
- Architecture
- tracekit why: architecture
Integrations
- Integrations
- Adapters
- OpenTelemetry
- Remote clients
- Kubernetes agent-sandbox
- agentgateway
- agentsh and Tracekit
- Browser Use
- Claude Agent SDK
- Claude Code's sandbox
- Codex's sandbox
- CrewAI
- Docker MCP Gateway
- E2B
- Falco
- Gemini CLI's sandbox
- Google ADK
- Haystack
- LangChain v1
- LiteLLM
- LlamaIndex
- MCP client
- microsandbox
- Microsoft Agent Framework
- OpenAI Agents SDK
- NVIDIA OpenShell
- Pydantic AI
- sandbox-runtime's proxy on its own
- Strands Agents
- Tetragon
- Vercel AI SDK
- Wassette
Policy and approvals
- Policy reference
- Approvals
- Findings
- Reading the model's reasoning
- Incidents and containment
- Webhooks
Deploy and operate
- Deploying the signer
- The signer as a container
- The signer on Kubernetes
- The compose stack
- Identity
- Tool executor
- MCP gateway
- LLM gateway
- Egress observation
- Witnesses
- Log monitor
- Record-key issuer
- Signer observability
- Viewer
- tracekit why: causal investigation and replay
- Migrating
- Platforms
Verify the evidence
- Reading a v2 verify report
- Evidence format v2
- Auditor guide
- Sample evidence bundle
- Signing
- What Tracekit guarantees
Security and privacy
- Threat model: the v2 signer
- Threat model: the v1 laptop signer
- HTTP security checklist
- Threat-model review packet
- Privacy
- Known limits and trade-offs
- What's stable
Compliance
- Compliance mapping
- EU AI Act
- ISO/IEC 42001
- NIST AI RMF and the Generative AI Profile
- OWASP Top 10 lists for LLM and agentic applications
Evaluation
Demos
- Demos
- Agent approvers within bounds
- Completeness and tamper evidence
- Detection and containment
- Network coverage: an egress observer
- Guardrails: allow, deny, or ask a person
- MCP tools, gated and recorded
- Prompt injection held by provenance
- Why: which input caused the action
Help