---
title: Your agent needs a quiver, not your keys
description: How Zerion lets a trading agent act for you: a session key bound to a guardrail policy, the policy's hash on Robinhood Chain, a dry run before it trades, and no way to withdraw.
date: 2026-11-03
tags:
  - Agents
  - Guardrails
author: Zerion team
---

A quiver holds a set number of arrows and nothing else. That is what an agent should get from you: a limited set of things it may do, for a limited time. Not your keys.

This post explains how agents work on Zerion: session keys, the guardrail policy they trade inside, how that policy ends up on Robinhood Chain, and why one setting can never be switched on.

## The problem with handing over keys

A trading agent is software that places orders for you. It might be a script, a bot or a model-driven assistant you wrote or chose. To trade, it has to sign. The easy way is to give it your private key or a full-access API key. Then it can do anything you can: trade any market at any size, and move funds out.

That works until something goes wrong. A bug, a misread instruction or a leaked key turns "anything you can do" into the size of the problem.

## Session keys

Zerion gives an agent a session key instead. A session key is a separate key, created for the agent, that only works inside a policy you set and only until it expires. Your own wallet's key never leaves you.

The policy is the quiver. Every order the agent signs with its session key is checked against the policy before it is placed. An order outside it is rejected with a reason, and the agent can't edit the policy.

## The policy

A policy has seven fields:

| Field | What it sets |
| --- | --- |
| `agent` | The agent it applies to, by name or address |
| `markets` | The markets it may trade: any of BTC, ETH, SOL, NVDA, AAPL, TSLA and GOLD |
| `maxNotional` | The largest order, in US dollars per order |
| `maxLeverage` | The highest leverage per order |
| `maxDailyLoss` | The most it may lose in a day, in US dollars, realised plus unrealised; resets at 00:00 UTC |
| `canWithdraw` | Always `false` |
| `expiresInHours` | How long the session key lives |

Here is an example for a sample agent we call fletcher-2 (a fletcher makes arrows):

```json
{
  "agent": "fletcher-2",
  "markets": ["BTC", "ETH", "NVDA"],
  "maxNotional": 500,
  "maxLeverage": 10,
  "maxDailyLoss": 50,
  "canWithdraw": false,
  "expiresInHours": 24
}
```

In words: fletcher-2 may trade Bitcoin, Ethereum and NVIDIA, up to $500 per order at up to 10× leverage. Once the day's loss reaches $50 it can't open anything new. It can never withdraw, and its key stops working after 24 hours.

## One policy, one hash

To put a policy on-chain without publishing it, Zerion hashes it. A hash is only useful if the same policy always produces the same bytes, so the policy is first written in a canonical form:

- keys in a fixed order: `agent`, `markets`, `maxNotional`, `maxLeverage`, `maxDailyLoss`, `canWithdraw`, `expiresInHours`
- `markets` sorted alphabetically
- no whitespace
- `canWithdraw` always written as `false`

The example above becomes:

```
{"agent":"fletcher-2","markets":["BTC","ETH","NVDA"],"maxNotional":500,"maxLeverage":10,"maxDailyLoss":50,"canWithdraw":false,"expiresInHours":24}
```

Its keccak256 hash, taken over the UTF-8 bytes of that string, is:

```
0xa8e4f4ac82a51fe4bed334de1d25026e3d20dfc76006d3bf31b8c169fa03575a
```

List the markets as NVDA, BTC, ETH, or format the JSON differently, and the canonical form, and so the hash, stays the same. Change a single limit and the hash changes completely.

You can check it yourself with viem:

```ts
import { keccak256, toBytes } from "viem";

const canonical =
  '{"agent":"fletcher-2","markets":["BTC","ETH","NVDA"],"maxNotional":500,"maxLeverage":10,"maxDailyLoss":50,"canWithdraw":false,"expiresInHours":24}';

console.log(keccak256(toBytes(canonical)));
```

## Registering it on Robinhood Chain

The hash goes to Zerion's contract on Robinhood Chain, VolleyLog:

```solidity
registerPolicy(address agent, bytes32 policyHash, uint64 expiresAt)
```

- `agent` is the address of the agent's session key.
- `policyHash` is the hash above.
- `expiresAt` is when the session ends, as a Unix time in seconds. For a 24-hour policy, that is the time you register plus 24 hours. The contract rejects an expiry that isn't in the future.

The transaction is sent from your own wallet, so the record says: this owner approved this exact policy for this agent until this time. Policies are stored per owner and per agent, and registering again for the same agent replaces the old one. Anyone can read it back with `policyOf(owner, agent)`, which returns the hash, the expiry and whether the policy is still active.

Only the hash goes on-chain. The limits themselves stay private unless you share the JSON, and anyone you share it with can hash it and compare.

## Revoking

You can take the key back early with `revokePolicy(agent)`. It deletes your policy for that agent and emits an event, so the revocation is as public as the registration. Only the owner who registered a policy can revoke it.

Expiry needs no transaction at all. Once `expiresAt` passes, the policy is no longer active, and orders from the session key are rejected with "Session key expired".

## A dry run before the first arrow

Before an agent trades, you can replay a list of orders against the policy and see what would happen. Each order goes through the checks in this order: is the session key still valid, is it a withdrawal, is the market allowed, is the size under the cap, is the leverage under the cap, has the day's loss limit been reached. The first check that fails gives the reason.

Against the example policy:

| Order | Result |
| --- | --- |
| Long BTC, $400 at 5× | Inside the policy |
| Long SOL, $200 at 3× | SOL is not in the market list |
| Short ETH, $800 at 5× | $800 is over the $500 size cap |
| Long NVDA, $300 at 20× | 20× is over the 10× cap |
| Withdraw | Withdrawals are never allowed |
| Any order once the day's loss has reached $50 | Daily loss limit of $50 reached |

The results are the exact messages the check returns. A dry run is cheap, and it catches the boring mistakes: a market you forgot, or a leverage cap lower than the agent's strategy assumes. You can try one with a sample agent in the [policy builder](/#policy).

## Why withdrawals are always false

`canWithdraw` isn't a setting. In the policy type its only allowed value is `false`, and the canonical form writes `false` whatever it is given. No version of the policy lets a session key move funds out.

The reason is the difference between two kinds of damage. A bad trade inside the policy is bounded by the market list, the size cap, the leverage cap and the daily loss limit. A withdrawal isn't bounded by any of them, and it can't be undone. So moving money out stays with you, signed with your own key.

## What a policy doesn't do

- **It doesn't make an agent good.** A policy limits the damage. It says nothing about whether the agent's trades are any good.
- **The daily loss limit is a brake, not a stop-loss.** It blocks new orders once the loss is reached. It doesn't close positions that are already open, and a leveraged position can lose more than its margin.
- **The chain holds the hash, not the rules.** Orders are checked against the policy when they are placed. What the on-chain hash adds is a public, timestamped record of exactly which policy you approved, so it can't be swapped quietly afterwards.

The policy doesn't depend on what the agent is. A script, a bot or a model-driven assistant can all be held to the same seven fields.
