Agents & API

Agent keys

Read-only API keys for monitoring bots, the on-chain agent registration that lets a bot mutate strategies, and how to keep both safe.

Last updated 2 min readv1.0

Bots touch Elysium Morning in two ways. An API key (em_…, from Agents or POST /api/agents) lets software read your account and portfolio through the API. To act, a bot signs transactions from its own address, which you authorise on-chain with ForgeFactory.setAgent for specific strategies. The API never signs or sends transactions for you.

Every agent request passes six checks in order: key, revocation, scope, rate limit, strategy allow-list, then template bounds and phaseBearer em_…key lookup (hash)Not revokedowner still existsScopepropose · bid · mutateRate limitratePerHourAllow-liststrategyIdsBounds + phasetemplate rulesany failure → 401 / 403 / 429 / 409 / 422 with { error, code }, nothing executes, the attempt is loggedall pass → action executes, the call is counted and logged against the key (calls, lastUsedAt)

#Anatomy of a key

AgentKey (types.ts)TypeScript
type AgentScope = "propose" | "bid" | "mutate";
interface AgentKey {
  id: string; owner: string; label: string;
  prefix: string;          // first chars, for display; the full key is shown once
  scopes: AgentScope[];
  ratePerHour: number;
  strategyIds: string[];   // empty = all strategies the owner controls
  createdAt: number; lastUsedAt?: number;
  calls: number; revoked: boolean;
}

#Scopes

ScopeIntended forEffect in live mode
proposeA builder bot that proposes each dawnRecorded on the key. Proposing is DawnScheduler.propose signed by a wallet; the API returns 409 onchain_required.
bidAn allocator that backs proposals by ruleRecorded on the key. Bidding and voting are wallet-signed transactions.
mutateFee tuning, rebalancingRecorded on the key. Mutations are ForgeFactory.mutate calls from an address you registered with setAgent.

An em_… key can read GET /api/account and GET /api/portfolio as its owner. No key can withdraw funds, sunset a strategy, create keys or change account settings.

#Rate limits and allow-lists

  • ratePerHour caps every API call the key makes, reads included. Pick the lowest value your loop needs.
  • On-chain, ForgeFactory enforces the real limits: the owner registers an agent address per strategy with setAgent(strategy, agent, callsPerHour, selectors) (cap 120/h, token bucket with continuous refill) and a per-selector allow-list; the strategy re-checks values against template bounds.
  • Register only the strategies and selectors the bot needs. Remove an agent with ForgeFactory.revokeAgent(strategy, agent), and narrow it with setAgentSelector(strategy, agent, selector, allowed).

#Security

Every authenticated API call updates calls and lastUsedAt. On-chain mutations by an agent address are public in the strategy's mutation log.

Something unclear or wrong on this page? Report it.Updated Dec 1, 2026 · v1.0