Signed, tamper-evident decision evidence for OpenAI Agents SDK workflows using LoopGrid
pip install loopgrid-openai-agents Copy PIP instructions
Native OpenAI Agents SDK tracing + lifecycle integration for LoopGrid, the evidence plane for AI agents.
loopgrid-openai-agents maps the Agents SDK native tracing and run lifecycle into LoopGrid decision evidence without changing the LoopGrid Core contract.
application starts consequential decision ↓ OpenAI Agents SDK GenerationSpan end ↓ LoopGrid model_completed ↓ explicit application policy / human review ↓ OpenAI Agents SDK RunHooks.on_tool_start ↓ LoopGrid tool_requested ↓ actual local tool invocation ↓ OpenAI Agents SDK RunHooks.on_tool_end ↓ LoopGrid tool_executed ↓ application explicitly observes downstream outcome ↓ LoopGrid outcome_observed ↓ evidence_complete → cryptographic verification LoopGrid does not execute tools, invent delegated authority, invent policy, invent a reviewer, or infer a real-world outcome from an SDK tool return.
Tool evidence is deliberately taken from RunHooks.on_tool_start / on_tool_end, not from FunctionSpan start/end. OpenAI Agents can create a function span when a needs_approval call pauses before execution; the run hooks bracket the actual local tool invocation, so a pending approval cannot be misreported as execution evidence.
hooks = loopgrid.run_hooks(decision_id) result = Runner.run_sync(agent, prompt, run_config=run_config, hooks=hooks) if result.interruptions: state = result.to_state() for interruption in result.interruptions: # Authenticate and authorize this identity in YOUR application. reviewer = "reviewer@example.com" loopgrid.record_human_review( decision_id, reviewer=reviewer, approved=True, reason="Reviewed refund evidence", ) state.approve(interruption) result = Runner.run_sync(agent, state, run_config=run_config, hooks=hooks) For durable approvals, keep the full serialized RunState in trusted server-side storage. Do not accept a client-supplied replacement state as authoritative.
The integration uses two native Agents SDK surfaces for different evidence boundaries:
Transport work is queued to a background worker so tracing and run-hook callbacks return quickly.
Decision association is explicit and concurrency-safe:
run_config = RunConfig(trace_metadata=loopgrid.trace_metadata(decision_id)) hooks = loopgrid.run_hooks(decision_id) There is no process-global mutable "current decision". A resumed approval flow can recreate run_hooks(decision_id) in the process that actually resumes the run.
Model outputs and tool inputs/outputs are represented by SHA-256 commitments rather than raw content. For defense in depth, also use:
RunConfig(trace_include_sensitive_data=False) The OpenAI Agents SDK documentation notes that tracing can contain model and function inputs/outputs unless sensitive-data tracing is disabled.
Tracing and run-hook callbacks never raise into the Agents SDK execution path. LoopGrid transport failures are retained and surfaced explicitly:
loopgrid.flush() loopgrid.assert_healthy() A successful agent run is not evidence that LoopGrid transport succeeded unless assert_healthy() passes.
RC2 is not a public release. Required gates before v0.1.0:
openai-agents agents-sdk ai-agents agent-governance decision-evidence audit-trail provenance tamper-evident loopgrid
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
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 verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.




