How to Run Latch
Latch is the agent authorization layer built on Rialo. Delegate real authority to AI agents — real spend, real API access, real execution — without ever handing over a key they can leak or that can be compromised.
What is Latch?
Latch is an agent governance platform. The core problem it solves: most AI agents today are given master API keys to do their job. A master key handed to an agent is a bet that nothing ever goes wrong. If the agent is compromised, misused, or just makes a mistake — there is no limit on the damage.
Latch replaces master keys with scoped authority. Instead of a key the agent can leak, it receives a policy — a Latch — that defines exactly what it can do, how much it can spend, which tools it can call, and which files it can touch. Every action produces a signed receipt. The damage is bounded. The investigation is possible.
Latch went fully live in 2026. Anyone can define a policy and deploy an agent today at onlatch.com.
Built on Rialo
Latch is built on top of the Rialo network. It uses Rialo's native automation, confidential computation (TEE), and machine-bound identity to make agent governance enforceable rather than advisory.
How it works
Your agents run in real execution environments. When an agent calls a tool, makes an API request, writes a file, or spends tokens — that request hits Latch's local authorization server before it executes.
The authorization server evaluates the request against your policy in real time. The result is one of three outcomes:
| Outcome | What happens | Example |
|---|---|---|
| ✅ Allow | Action runs automatically | Read a file within allowed paths |
| ⏸ Ask | Pauses, sends you an approval request | Spend above your set threshold |
| ❌ Block | Action is denied, agent receives an error | Access a blocked file glob or tool |
Safe actions run automatically without interrupting your workflow. Risky or ambiguous actions wait for your approval. Blocked actions never execute.
The 8 authorization layers
Every request from an agent passes through eight evaluation layers in order. The first layer to trigger a block or ask stops the chain.
Rate limiting
Cap how many times an agent can call a tool or endpoint per minute, hour, or day. Prevents runaway loops and unexpected cost spikes.
# Maximum calls allowed within each time window
rate_limits:
max_tool_calls_per_minute: 20
max_api_calls_per_hour: 100
max_spend_calls_per_day: 10
Permission flags
Define the capabilities your agent is allowed. Start restrictive — only enable what the agent actually needs.
# Toggle individual capabilities on or off
permissions:
read_files: true # agent can read files
write_files: false # agent cannot write files
spend_tokens: true # agent can spend (within limits)
deploy: false # agent cannot deploy contracts
run_shell: false # agent cannot run shell commands
Tool rules
Allowlist or blocklist specific tools by name. The agent can only invoke tools explicitly listed in the allow list — everything else is blocked by default.
# Only these tools are permitted — all others are blocked
tools:
allow:
- read_file
- search_docs
- fetch_price
block:
- delete_file
- run_command
- deploy
MCP rules
Control which MCP (Model Context Protocol) servers and methods the agent can connect to and call.
# Restrict which MCP servers and methods are accessible
mcp:
allow_servers:
- rialo-docs
- price-feed
block_methods:
- "admin/*" # block all admin methods
- "system/*" # block all system methods
Command rules
Restrict shell commands to a safe allowlist. Prevents agents from running arbitrary system commands that could cause damage.
# Only these shell commands are permitted
commands:
allow:
- "cargo build"
- "rialo deploy"
- "git status"
block:
- "rm -rf" # destructive delete
- "curl | sh" # remote code execution
- "sudo *" # privilege escalation
Blocked globs
Prevent agents from reading or writing sensitive file paths using glob patterns. Protects secrets, credentials, and production config.
# File paths the agent can never access
blocked_globs:
- "**/.env" # environment variables
- "**/secrets/**" # secrets directory
- "**/*.pem" # private keys and certs
- "**/prod/**" # production configs
Destructive action confirmation
Any action flagged as destructive — deleting data, deploying to production, large spends — automatically pauses and sends you an approval request before proceeding.
LLM evaluator
Ambiguous actions that don't clearly match a rule are evaluated by a language model judge. The evaluator decides allow, ask, or block based on the intent and context of the request.
Machine-bound identity
Traditional agent security relies on API keys. Keys can be leaked in logs, stolen from memory, or accidentally committed to a repo. Rotating them is painful and doesn't undo the damage.
Latch uses a different model. An agent's authority comes from being on a policy whitelist tied to the machine — not from possessing a secret string. There is no key to steal because there is no key.
Remove the machine from the policy whitelist or delete the Latch. The agent loses all authority immediately — no key rotation, no waiting, no risk window.
Get started
You don't need to install anything to use Latch. Go to the dashboard, define a policy, and your agents are ready to run under it.
Open the Latch dashboard
Go to onlatch.com/latches and sign in or create a free account. No waitlist.
Configure Basics & Credentials
The Latch setup has 3 tabs — fill them in order:
- Basics — Enter a Name (e.g.
Stripe) and the Upstream Base URL (e.g.https://api.stripe.com). Toggle Log request body and Log response body on or off depending on how much activity logging you want. - Credentials — Select an existing Secret from the dropdown or click + New secret to create one. Set the Timeout (ms) — default is
30000(30s, enforced range: 10–30s) — and an optional Expires At date for the credential.
Configure your policy rules
Use the policy editor to define exactly what your agent is allowed to do:
- Set which tools the agent can call
- Define blocked file globs to protect sensitive paths
- Set a spend limit if the agent handles token payments
- Configure rate limits to cap how often it can act
- Enable destructive action confirmation for risky operations
Each rule is validated in the editor before the policy goes live.
Copy your Latch key
Once the policy is saved, copy the Latch receipt key from the dashboard. This is passed to your Rialo agent at deploy time to bind it to the policy.
export LATCH_KEY=latch_live_xxxxxxxxxxxxxxxxxxxx
Create a Latch policy in code
You can also define policies programmatically inside a Rialo program using the SCALE agent framework:
use rialo_cdk::scale::{Agent, LatchPolicy};
#[rialo::program]
pub fn create_latch_agent(ctx: Context) -> Result<()> {
let policy = LatchPolicy::builder()
.name("rialo-agent")
// Permissions
.allow_read_files(true)
.allow_write_files(false)
.allow_deploy(false)
// Spend controls
.spend_limit_usdc(50) // hard cap: $50 per execution
.require_approval_above_usdc(10) // ask human if spend > $10
// Tool rules
.allow_tools(vec!["fetch_price", "read_file", "search_docs"])
// File protection
.block_globs(vec!["**/.env", "**/secrets/**", "**/*.pem"])
// Rate limits
.max_calls_per_minute(20)
// Destructive action handling
.confirm_destructive(true)
.build();
let agent = Agent::new(ctx, policy)?;
agent.deploy()?;
Ok(())
}
Run an agent under a Latch
# Set your Latch key
export LATCH_KEY=latch_live_xxxxxxxxxxxxxxxxxxxx
# Build and deploy your Rialo agent
rialo build
rialo deploy --latch $LATCH_KEY
# Check the agent is running under the policy
rialo agent status
# View live receipts
rialo agent receipts --tail
Every action is now checked before it runs. The agent operates within the policy boundaries — automatically, without any code changes to the agent itself.
Per-session scoping
You can create different Latch policies for different contexts. Lock down production environments while keeping development permissive.
| Session type | Recommended policy |
|---|---|
| Production | Read-only files, spend limit $5, confirm all writes, no shell |
| Staging | Read/write files, spend limit $20, confirm destructive only |
| Development | Permissive, high rate limits, no spend cap |
| Automated CI | Allowlisted tools only, no spend, blocked secrets globs |
Spend controls
When an agent handles token payments or API costs, Latch gives you precise spend controls at every level:
Monitor & audit
Every action your agent takes under a Latch policy produces a signed receipt. Receipts are stored on Rialo and viewable in the Latch dashboard at onlatch.com/latches.
Each receipt contains:
- Timestamp and agent machine identity
- The exact action taken — tool call, API request, file write, spend
- Which policy rule evaluated it and the outcome (allow / ask / block)
- The spend amount if applicable
- A cryptographic signature for tamper-proof verification
# View all receipts for an agent
rialo agent receipts
# Filter by outcome
rialo agent receipts --filter blocked
rialo agent receipts --filter ask
# Export receipts as JSON for audit
rialo agent receipts --export receipts.json
Revoking access
To revoke an agent's authority instantly:
- Go to onlatch.com/latches
- Open the Latch policy the agent is running under
- Click Disable or Delete
The agent loses all authority immediately. No key rotation. No waiting. No risk window. Since identity is machine-bound — not key-bound — there is nothing to invalidate on the agent side.