Documentation in Progress

This documentation is a proof of concept and is still heavily in progress. The actual product implementation may differ from what is described here. Information is subject to change as we continue developing Relay.

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 relay

2. 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 call

4. See actions in Relay dashboard

Visit relaydev.ai to view all agent actions, approvals, and rollbacks in real-time.

SDKs

Python

Install

pip install relay

Initialize Relay

from relay import Relay

relay = Relay(proxy="relay.dev")

Wrap tools

tools = relay.wrap({
    send_email,
    refund,
    update_crm,
    delete_record
})

Example call

# Use wrapped tools in your agent
result = tools.send_email(
    to="customer@example.com",
    subject="Thank you",
    body="Thanks for your order!"
)
# Relay intercepts, evaluates, and logs the call

JavaScript

Install

npm install @relay-dev/relay

Initialize 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

// Use wrapped tools in your agent
await tools.sendEmail({
    to: 'customer@example.com',
    subject: 'Thank you',
    body: 'Thanks for your order!'
})
// Relay intercepts, evaluates, and logs the call

Concepts

Execution Proxy

Relay acts as a transparent proxy between your agents and their tools. Every tool call flows through Relay before execution.

Agent
Relay
Tool

Relay evaluates each action through detection layers, enforces policies, and can pause execution for human approval before the tool is called.

Guardrails & Policies

Policies define what's allowed, what requires approval, and what's blocked. They're 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_approval

Policies 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 agent

The agent can check approval status or continue with other tasks while waiting.

Rollbacks & 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
# - invoice generated
# - analytics event logged

# Rollback plan generated:
rollback:
  - action: reverse_refund
    target: transaction_123
  - action: send_correction_email
    to: correct_customer@example.com
  - action: update_crm
    record: correct_customer_id
  - action: cancel_invoice
    id: invoice_456

Some actions can't 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 (e.g., sending an email triggers a CRM update), Relay tracks the dependency.

The execution graph enables accurate blast radius calculations: if you rollback 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:
  # Require approval for large refunds
  - tool: refund
    condition: "args.amount > 50000"
    action: require_approval
  
  # Block external emails
  - tool: send_email
    condition: "args.to endsWith '@external.com'"
    action: block
  
  # Rate limit per hour
  - tool: send_email
    condition: "count(last_hour) > 100"
    action: block
  
  # Always require approval
  - tool: delete_record
    action: require_approval

Rollbacks

rollback:
  # Auto-rollback on errors
  - on: error
    condition: "error.type == 'unauthorized'"
    action: auto_rollback
  
  # Compensate for emails
  - on: send_email
    action: draft_correction_email
  
  # Custom rollback handlers
  - on: refund
    action: custom_rollback_handler
    handler: scripts/reverse_refund.py

Integrations

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.

# In your Azure AI Foundry agent config
{
  "proxy": "relay.dev",
  "tools": [...]
}

Custom Agents

For custom agents, you can either wrap tools directly (if they're 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/proxy

FAQ

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 <10ms. Anomaly detection adds ~30ms. AI semantic analysis adds ~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.