Documentation in progress
This documentation is a proof of concept and is still in progress. The actual product implementation may differ from what is described here.
Relay Documentation
Relay is the action control plane for AI agents. It intercepts tool calls, enforces safety, and helps you recover from mistakes.
Relay sits between your agents and their tools, providing real-time protection and recovery capabilities without requiring changes to your agent logic.
Quickstart
Get started with Relay in minutes. Follow these steps to set up Relay with your agent.
1. Install SDK
pip install relay2. Wrap your tools
from relay import Relay
relay = Relay(proxy="relay.dev")
tools = relay.wrap({ send_email, refund, update_crm })3. Run your agent
# Your agent uses wrapped tools
agent.run(prompt="Send thank you email to customer")
# Relay intercepts and evaluates each tool call4. See actions in Relay dashboard
Visit relaydev.ai to view all agent actions, approvals, and rollbacks in real time.
SDKs
Python
Install
pip install relayInitialize Relay
from relay import Relay
relay = Relay(proxy="relay.dev")Wrap tools
tools = relay.wrap({
send_email,
refund,
update_crm,
delete_record
})Example call
result = tools.send_email(
to="customer@example.com",
subject="Thank you",
body="Thanks for your order!"
)
# Relay intercepts, evaluates, and logs the callJavaScript
Install
npm install @relay-dev/relayInitialize Relay
import { Relay } from '@relay-dev/relay'
const relay = new Relay({ proxy: 'relay.dev' })Wrap tools
const tools = relay.wrap({
sendEmail,
refund,
updateCRM,
deleteRecord
})Example call
await tools.sendEmail({
to: 'customer@example.com',
subject: 'Thank you',
body: 'Thanks for your order!'
})
// Relay intercepts, evaluates, and logs the callConcepts
Execution Proxy
Relay acts as a transparent proxy between your agents and their tools. Every tool call flows through Relay before execution.
Relay evaluates each action through detection layers, enforces policies, and can pause execution for human approval before the tool is called.
Guardrails and Policies
Policies define what is allowed, what requires approval, and what is blocked. They are evaluated before execution.
policies:
- tool: refund
condition: "args.amount > 50000"
action: require_approval
- tool: send_email
condition: "args.to endsWith '@external.com'"
action: block
- tool: delete_record
action: require_approvalPolicies support conditions based on arguments, execution context, and historical patterns.
Human-in-the-loop
When an action requires approval, Relay pauses execution and returns a 202 status with an approval request ID. Your agent can wait or continue with other work.
# Agent calls tool
result = tools.refund(amount=100000)
# If approval required, Relay returns:
# {
# "status": "pending_approval",
# "approval_id": "req_123",
# "url": "https://relay.dev/approve/req_123"
# }
# Human approves via dashboard
# Tool executes, result returned to agentThe agent can check approval status or continue with other tasks while waiting.
Rollbacks and Compensations
When something goes wrong, Relay tracks the blast radius -- every action and side effect triggered by a mistake. Rollback plans can restore state, cancel follow-up actions, and draft corrective messages.
# Mistake detected: wrong customer refunded
# Relay shows blast radius:
# - refund($10,000) executed
# - email sent to wrong customer
# - CRM record updated
rollback:
- action: reverse_refund
target: transaction_123
- action: send_correction_email
to: correct_customer@example.com
- action: update_crm
record: correct_customer_idSome actions cannot be fully reversed (like sent emails). Relay identifies what can be undone and suggests compensating actions for the rest.
Execution Graph
Relay maintains an execution graph showing parent-child relationships between actions. When one action triggers another, Relay tracks the dependency.
The execution graph enables accurate blast radius calculations: if you roll back a parent action, Relay knows which child actions were caused by it and should be rolled back too.
Configuration
relay.yaml
Relay configuration lives in a relay.yaml file at your project root. This file is version-controlled alongside your code.
# relay.yaml
proxy: relay.dev
policies:
# ... policies ...
rollback:
# ... rollback config ...Policies
policies:
- tool: refund
condition: "args.amount > 50000"
action: require_approval
- tool: send_email
condition: "args.to endsWith '@external.com'"
action: block
- tool: send_email
condition: "count(last_hour) > 100"
action: block
- tool: delete_record
action: require_approvalRollbacks
rollback:
- on: error
condition: "error.type == 'unauthorized'"
action: auto_rollback
- on: send_email
action: draft_correction_email
- on: refund
action: custom_rollback_handler
handler: scripts/reverse_refund.pyIntegrations
LangChain
Wrap your LangChain tools with Relay before passing them to the agent.
from langchain.agents import AgentExecutor
from relay import Relay
relay = Relay(proxy="relay.dev")
tools = [relay.wrap(tool) for tool in your_tools]
agent = AgentExecutor.from_agent_and_tools(
agent=your_agent,
tools=tools
)CrewAI
Wrap tools before creating CrewAI agents.
from crewai import Agent, Task
from relay import Relay
relay = Relay(proxy="relay.dev")
wrapped_tools = relay.wrap({send_email, update_crm})
agent = Agent(
role="Customer Support",
tools=wrapped_tools
)AutoGen
Wrap function calls in AutoGen function routing.
from autogen import ConversableAgent
from relay import Relay
relay = Relay(proxy="relay.dev")
wrapped_functions = relay.wrap({send_email, refund})
agent = ConversableAgent(
name="assistant",
llm_config={"functions": wrapped_functions}
)Azure AI Foundry
Configure Relay as a proxy endpoint in your Azure AI Foundry agent configuration.
{
"proxy": "relay.dev",
"tools": [...]
}Custom Agents
For custom agents, you can either wrap tools directly (if they are Python functions) or configure Relay as an HTTP proxy that intercepts all tool call HTTP requests.
# Option 1: Wrap Python functions
from relay import Relay
relay = Relay(proxy="relay.dev")
tools = relay.wrap({your_tool_function})
# Option 2: HTTP proxy
# Configure your agent's HTTP client to route
# all tool calls through relay.dev/proxyFAQ
Does this change my agent logic?
No. Relay wraps your tools transparently. Your agent code stays the same -- just replace your tools with wrapped versions. The agent still calls the same functions with the same arguments.
How fast is the proxy?
Relay adds minimal latency. Static policy checks take under 10ms. Anomaly detection adds roughly 30ms. AI semantic analysis adds roughly 800ms. Most actions pass through the fast layers.
Can I self-host?
Self-hosting is available for enterprise customers. Contact us for details.
What happens if Relay is down?
Relay has a fail-open mode. If Relay is unreachable, actions proceed directly to tools (no protection, but your agents keep running). You can also configure a fail-closed mode that blocks actions when Relay is down.
Is this for production?
Yes. Relay is designed for production use with high availability, low latency, and enterprise-grade reliability.