Skip to main content

Directory Structure


Agent Code

run Function

  • Signature: def run(agent: AgentContext) -> None:
  • Called when a [[triggers]] entry fires (the schedule trigger, or a reactive trigger)
  • Receives AgentContext with session data and SDK methods
  • Returns void (no return value)

unwind Function

  • Signature: def unwind(agent: AgentContext) -> None:
  • Called when you ask the agent to unwind positions
  • Optional unwind logic using agent.allocation
  • Returns void (no return value)

The plan: DESCRIPTION.md

Every agent must include a DESCRIPTION.md file alongside circuit.toml. It is the agent’s plan - the short prose a user reads to decide whether to deploy, rendered as a card on the agent’s page in Circuit. Write all five sections below; keep each line plain, concrete, and present-tense, with real asset/protocol names and no filler.
## What it is renders as labeled chips, so its rows must use exactly the labels for your circuit.toml category - a missing or mislabeled row is silently dropped from the card. Each value is an ultra-short noun phrase (plain names, no tickers or parentheticals):

circuit.toml

The circuit.toml file defines your agent’s metadata, asset requirements, execution settings, and deployment configuration. It must be in the root of your agent directory.

Full Example

Field Reference

Deployment Regions

[[triggers]] Section

Triggers are the only dispatch configuration: what the config lists is exactly what wakes your agent, nothing is implied or defaulted. Every agent declares exactly one schedule trigger (the guaranteed periodic wake), and may add reactive triggers that wake run() early when something the agent watches changes.
Schedule trigger fields: Price trigger fields: Drawdown trigger fields: A drawdown trigger is a session-level breaker: it wakes the agent the moment the session’s PnL falls a full band below its high-water mark, so de-risking doesn’t wait for the next scheduled run. PnL is flow-adjusted (net of deposits, withdrawals, and fees), so moving money in or out never reads as a loss. After a fire the mark re-anchors at the current PnL, so each further band down fires again (staged de-risking). Inside run(), agent.trigger carries the wake cause so the agent can branch on why it woke. A drawdown wake carries pnlUsd, peakPnlUsd, drawdownUsd, and (when peak equity is positive) drawdownPct - display-tier hints; read live state to decide what to de-risk.

[startingAsset] Section

Defines the token a user must hold to start a session.

Common Configurations

EVM agent with ETH on mainnet:
EVM agent with USDC on Polygon:
Solana agent with SOL:
Hyperliquid perps agent:

Agent Identity

Your agent’s identity is its agentId - a UUID that circuit new generates once and writes into circuit.toml. Every circuit upload replaces the runnable content for the agent with that id, so sessions and other state stay attached to it. You can rename the agent (name) or change its slug freely - because identity lives in agentId, renaming updates the same agent in place instead of forking a new one. Two rules the tooling enforces for you:
  • Never edit agentId. It’s the permanent link to your published agent; changing it points at (or creates) a different agent. To intentionally start a brand-new agent, run circuit new (which mints a fresh agentId).
  • slug is unique among your agents. circuit new derives it from the name and appends -2, -3, … if you already own that slug; circuit check fails (offline) if two agents in your workspace share an agentId or slug, so a copy-paste mistake can’t silently overwrite another agent on publish.

[settings] Section

Define configurable settings that users can customize when starting a session. Each setting is a TOML table under [settings.X] where X is the setting key. The display label is auto-derived from the key (snake_case to Title Case).
Required settings have no default value. Users must provide a value before the agent runs. The agent will refuse to execute if any required settings are missing.
Setting fields: Type rules: Limits:
  • Maximum 20 settings per agent
  • Maximum 20 options per single_select setting
  • Options must be unique within a setting
  • Setting keys must be unique across all settings
  • Setting keys cannot be numeric (e.g. 0, 3.14) - use a descriptive name instead
  • Default values for single_select must match a valid option
Settings are displayed to users in the order they appear in the file. Settings are snapshotted with each uploaded version - changing settings requires a new upload. At runtime, resolved setting values (defaults merged with session overrides) are available on AgentContext. See Settings SDK Reference for access patterns.

[exchangeCredentials] Section

Declare exchange credentials your agent needs. Circuit shows a credential picker when the user starts a session, then seats a runtime permit scoped to that selected credential. Read-only attachments receive wallet.read; trading attachments receive wallet.sign, which includes private reads. For trading credentials, Circuit also asks for the venue allocation. The selected credential belongs to the session; the exact venue allocation is an append-only session allocation fact. Neither appears in agent.settings. An agent version may currently declare one exchange venue, and each session attaches one credential for that venue.
At runtime, private agent.platforms.kraken.* calls automatically use the credential selected for the session; its id and secret are not exposed to agent code. For trade = true agents, agent.allocation contains invocation-start available kraken:allocation:USD cash (the user-declared slice minus deployed and pending buys) plus positive base-asset inventory carrying krakenMetadata; size sells from its exact availableBaseVolume.

Notes

  • circuit.toml has no version field. Each circuit upload hashes the uploaded bundle and the backend assigns the version automatically - there is nothing to bump by hand.
  • Runtime asset files (data, configs) the agent reads ship automatically when they live inside the agent directory. To share code across agents, use a workspace package - see Multi-Agent Monorepo.
  • .circuit is reserved for CLI-managed staging during local runs. Do not store agent source files under .circuit.
  • allowedExecutionModes order matters - the first entry is the execution mode for circuit run commands that omit --mode. Embedded execution accepts only auto; --dry-run accepts manual but warns that approvals are not simulated.

Next Steps