Skip to main content

openai-agents-relayshield

OpenAI Agents SDK tools and a mandatory pre-execution gate for RelayShield's agentic-security endpoints — MCP server registry risk and AI-agent-sourced credential breach detection.

Install

pip install openai-agents-relayshield

Tools

from agents import Agent, Runner
from openai_agents_relayshield import check_mcp_server_risk, check_prompt_injection_breach

agent = Agent(
    name="Assistant",
    tools=[check_mcp_server_risk, check_prompt_injection_breach],
)

result = await Runner.run(
    agent,
    "Is it safe to connect to the MCP server at https://mcp.example.com/sse? My RelayShield key is rs_live_...",
)
  • check_mcp_server_risk — flags known-malicious IOC matches, typosquat domains, and newly-registered domains hosting an MCP server, before an agent connects to or installs it.
  • check_prompt_injection_breach — checks whether an email appears in RelayShield's stolen-session corpus with a suspected-agentic-source marker (a session/token exposure that shows signs of having been captured via a compromised AI agent).

Both tools take api_key as a call argument rather than reading it from the environment implicitly — a shared agent process can act safely on behalf of multiple callers with different RelayShield keys.

Get a key at api.relayshield.net/developers.

Mandatory gate

Most "AI agent security" checks are optional — the agent can call them, but nothing stops it skipping the call and taking the risky action anyway. relayshield_mcp_gate is the other kind: a gate the framework enforces before a protected action (connecting to or installing an MCP server) can happen at all, built on the SDK's @tool_input_guardrail hook.

from openai_agents_relayshield.guardrail import relayshield_mcp_gate

# Attach directly to your own connect/install tool(s) — the guardrail is
# scoped by which tools you assign it to, not by matching tool names inside it.
connect_mcp_server.tool_input_guardrails = [relayshield_mcp_gate]

Properties, all non-negotiable by design:

  • A hook exception defaults to defer (blocked, with an explanatory message), never silently to allow — a gate failure must not become a pass.
  • Bounded retry applies only to transient upstream failures (timeout/429/5xx) — auth failures, malformed responses, and payment-required states are terminal after one attempt.
  • The gate logs the decision, reason codes, check version, target, and timestamp — never keys, payment proofs, or session material.
  • The raw connect/install tool should never be bound to the model directly in a real deployment — only route access to it through the gate.

Same normalized policy as langchain-relayshield's RelayShieldMCPGateMiddleware and its original standalone reference implementation, relayshield-langchain-gate — ported rather than imported, so this package has no dependency on LangChain/LangGraph.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openai_agents_relayshield-0.1.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openai_agents_relayshield-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file openai_agents_relayshield-0.1.0.tar.gz.

File metadata

File hashes

Hashes for openai_agents_relayshield-0.1.0.tar.gz
Algorithm Hash digest
SHA256 73290cf432d8de0de5612745ec17ab6dd68ae3a329c9152965575563fe0a100f
MD5 85b49bd84a55e4066e6dc9e52225d828
BLAKE2b-256 30b85519c82dfaafc67ab734f93a7b90883067f3ac124534b4fdca257750f497

See more details on using hashes here.

Provenance

The following attestation bundles were made for openai_agents_relayshield-0.1.0.tar.gz:

Publisher: publish.yml on nzdsf2-gif/openai-agents-relayshield

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openai_agents_relayshield-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for openai_agents_relayshield-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 93e2526ac4926077cf9ae6f3bf69d243fceb3f4f7ee7fbf45c306993fbbd0173
MD5 517ed8fccbe2d379a4dfa2cefc1bffde
BLAKE2b-256 6c3f0cf47050e6985664d5264b45e7b11d4890cd4d8ae16af2cb75d67a84c000

See more details on using hashes here.

Provenance

The following attestation bundles were made for openai_agents_relayshield-0.1.0-py3-none-any.whl:

Publisher: publish.yml on nzdsf2-gif/openai-agents-relayshield

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page