Skip to main content

openai-agents-trust

Trust & governance layer for the OpenAI Agents SDK. Adds policy enforcement, trust-gated handoffs, and tamper-evident audit trails using native SDK guardrails and hooks.

Built by AgentMesh — the open-source trust layer for multi-agent systems. Similar integrations merged into Dify (65K ⭐), LlamaIndex (47K ⭐), and Microsoft Agent-Lightning (15K ⭐).

Install

pip install openai-agents-trust

Quick Start

from agents import Agent, Runner
from openai_agents_trust import (
    trust_input_guardrail,
    policy_input_guardrail,
    GovernanceHooks,
    TrustGuardrailConfig,
    PolicyGuardrailConfig,
    TrustScorer,
    GovernancePolicy,
    AuditLog,
)

# Shared governance state
scorer = TrustScorer()
audit = AuditLog()
policy = GovernancePolicy(
    name="production",
    max_tool_calls=20,
    blocked_patterns=[r"DROP TABLE", r"rm -rf", r"eval\("],
    min_trust_score=0.7,
)

# Create guardrails
trust_config = TrustGuardrailConfig(scorer=scorer, min_score=0.7, audit_log=audit)
policy_config = PolicyGuardrailConfig(policy=policy, audit_log=audit)

# Attach to agents
agent = Agent(
    name="researcher",
    instructions="You are a research assistant.",
    input_guardrails=[
        trust_input_guardrail(trust_config),
        policy_input_guardrail(policy_config),
    ],
)

# Run with governance hooks
result = await Runner.run(
    agent,
    input="Analyze this data",
    run_config=RunConfig(hooks=GovernanceHooks(policy=policy, scorer=scorer, audit_log=audit)),
)

# Verify audit integrity
print(f"Audit entries: {len(audit)}")
print(f"Chain valid: {audit.verify_chain()}")

Trust-Gated Handoffs

from openai_agents_trust import trust_gated_handoff

billing_agent = Agent(name="billing", instructions="Handle billing.")
support_agent = Agent(name="support", instructions="Handle support.")

triage = Agent(
    name="triage",
    handoffs=[
        trust_gated_handoff(billing_agent, scorer=scorer, min_score=0.8),
        trust_gated_handoff(support_agent, scorer=scorer, min_score=0.6),
    ],
)

Features

Feature SDK Hook Description
Trust Guardrail InputGuardrail Blocks agents below trust threshold
Policy Guardrail InputGuardrail Enforces blocked patterns, tool limits
Content Guardrail OutputGuardrail Validates output against policies
Governance Hooks RunHooksBase Tracks tools, audits handoffs, scores trust
Trust-Gated Handoff is_enabled Disables handoffs to untrusted agents
Merkle Audit — Tamper-evident chain of all decisions

License

MIT

Metadata

Release files for openai-agents-trust 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openai-agents-trust 0.1.0
File Size Uploaded
openai_agents_trust-0.1.0.tar.gz 10.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openai-agents-trust 0.1.0
File Interpreter ABI Platform
openai_agents_trust-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.5 kB

Release files / openai_agents_trust-0.1.0.tar.gz

Download URL openai_agents_trust-0.1.0.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3f67e36cc9f701007c17906ea3e5044cf8d5c341da17495c11d9679cb374dca0
BLAKE2b-256 checksum
How to use checksums
a9df15bee1663062886abc8ca332985e4e4dd103b8f5c3b83131bad246644557
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / openai_agents_trust-0.1.0-py3-none-any.whl

Download URL openai_agents_trust-0.1.0-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c6b5fb0a49430326260393f7a97a01d00a58454322210aff8639993a1b04e57
BLAKE2b-256 checksum
How to use checksums
42158a68c4bd5e546fd2b28d614a74d36535f559fe5bbbdf25ca50b2f88d2ff0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page