← All integrations
OPENAI AGENTS SDK · NATIVE TRACING + RUNHOOKS · PYPI v0.1.0

Signed decision evidence for OpenAI Agents SDK.

Connect LoopGrid through the Agents SDK native tracing and run lifecycle. OpenAI Agents keeps running agents, models, approvals and tools; your application owns authority, policy, reviewer identity and the real downstream outcome; LoopGrid preserves and independently verifies the evidence.

loopgrid-openai-agents v0.1.0 · validated with openai-agents 0.23.1 · Python 3.10–3.14 CI · LoopGrid Core 0.8.1-design-partner.

NATIVE EVIDENCE FLOW
01Application decision + authority
02Generation evidence
03Explicit policy / human approval
04Actual tool request + execution
05Explicit observed outcome
06Evidence complete + verify

Tracing observes; it does not authorize. OpenAI Agents owns the agent and approval runtime. LoopGrid records evidence at native boundaries without inventing authority, reviewer identity or business outcome.

01 · INSTALL

Install the native OpenAI Agents SDK integration.

pip install loopgrid-openai-agents

Version 0.1.0 is public on PyPI. The package targets openai-agents 0.23.1.x, depends on loopgrid 0.8.x, and supports Python 3.10 or newer.

02 · CONNECT

Bind one consequential decision to one Agents SDK run.

from agents import Agent, RunConfig, Runner
from loopgrid_openai_agents import LoopGridOpenAIAgents

loopgrid = LoopGridOpenAIAgents(
    base_url="http://127.0.0.1:8000",
    workspace_id="default",
    agent_id="support-agent",
).install()

decision = loopgrid.start_decision(
    decision_type="customer_refund",
    agent={"id": "support-agent", "version": "1"},
    authority={"acting_for": "Example Store", "scope": ["refund:create"], "limit_usd": 100},
    model={"provider": "openai", "name": "gpt-5"},
    context={"prompt_version": "support-v1"},
    proposed_action={"tool": "refund.create", "amount": 25, "currency": "USD"},
    policy={"policy_id": "refund-policy", "version": "1", "decision": "auto_allowed"},
)

decision_id = decision["decision_id"]
hooks = loopgrid.run_hooks(decision_id)

result = Runner.run_sync(
    Agent(name="Support agent", instructions="Handle the request", tools=[...]),
    "Handle this duplicate charge.",
    run_config=RunConfig(
        trace_metadata=loopgrid.trace_metadata(decision_id),
        trace_include_sensitive_data=False,
    ),
    hooks=hooks,
)

loopgrid.flush()
loopgrid.assert_healthy()

# Only after your application observes the real downstream result:
loopgrid.record_outcome(
    decision_id,
    {"status": "succeeded", "external_reference": "refund_123"},
)

Decision correlation is explicit through native trace metadata and decision-scoped RunHooks. There is no process-global mutable “current decision”, so concurrent runs remain isolated.

03 · NATIVE LIFECYCLE

Use native tracing for model evidence and RunHooks for the actual tool boundary.

01Start decision

start_decision() records explicit agent identity, delegated authority, model/context provenance and the proposed consequential action.

02Generation evidence

LoopGridTracingProcessor maps native generation-span completion into model_completed evidence using privacy-safe commitments by default.

03Tool request

LoopGridRunHooks.on_tool_start() records tool_requested immediately before the actual local tool invocation.

04Tool completion

LoopGridRunHooks.on_tool_end() records execution/result evidence after the local tool returns; it does not infer the final business outcome.

05Human review

record_human_review() records an application-authenticated reviewer and explicit approval/rejection when supplied by the application.

06Observed outcome

record_outcome() appends the authoritative downstream outcome after the application actually observes it.

04 · APPROVAL + ACTION BOUNDARY

Keep OpenAI Agents approval native — and do not mistake a pending tool span for execution.

tool declared with needs_approval=True
  → OpenAI Agents interrupts the run
  → tool has NOT executed

application authenticates reviewer
  → loopgrid.record_human_review(...)
  → human_approved

application calls RunState.approve(...)
  → Runner resumes with decision-scoped hooks
  → tool_requested
  → actual tool executes once
  → tool_executed

application observes downstream result
  → loopgrid.record_outcome(...)
  → outcome_observed
  → evidence_complete
  → verify valid:true

The integration deliberately does not treat FunctionSpan start/end as proof of tool execution. Approval-gated calls may create a function span before approval; the native run hooks bracket the actual local invocation, preserving the approval-before-execution evidence order.

05 · PRIVACY + FAILURE MODE

Commit to content without storing it by default.

capture_content=False by default. Model content and tool inputs/outputs are represented with SHA-256 commitments rather than raw content unless capture is explicitly enabled.

For defense in depth, use RunConfig(trace_include_sensitive_data=False) at the OpenAI Agents tracing boundary as well. Tracing and run-hook callbacks queue transport work so they do not block the agent execution path. Call flush() and assert_healthy() when evidence delivery must be confirmed; a successful agent run alone is not proof that LoopGrid transport succeeded.

06 · RELEASE VALIDATION

Validated through the real Agents SDK runtime, approval/resume path and LoopGrid Core.

Automated tests20 / 20 semantic and integration tests passing
Framework runtimeReal Runner + deterministic ScriptedModel + function-tool execution on openai-agents 0.23.1
Human approvalNative interruption + RunState.approve(); reviewer evidence precedes tool_requested; approved tool executes exactly once
LoopGrid lifecycleevidence_complete
Applicable coverage100%
Verificationvalid: true with no failures
Public packageloopgrid-openai-agents==0.1.0 clean-installed from PyPI with public imports and both runtime E2Es revalidated
DistributionGitHub release v0.1.0; PyPI Trusted Publishing via GitHub OIDC

The release E2Es use the Agents SDK deterministic test model and sandbox-only refund functions, so no model-provider request or real-money movement is required. Verification establishes the integrity/provenance of captured evidence; it does not prove that the underlying decision was correct, that every upstream statement was true, or that the system is legally compliant.

OPENAI AGENTS SDK + LOOPGRID

Keep the Agents SDK native. Make the evidence portable.

Install the PyPI package, bind decision-scoped tracing and RunHooks, and preserve consequential agent evidence without replacing the OpenAI Agents runtime.