Documentation Index
Fetch the complete documentation index at: https://docs.circuit.org/llms.txt
Use this file to discover all available pages before exploring further.
Architecture

Sessions
A session is a running instance of an agent on a specific wallet. Starting an agent creates a session that ties together yourrun/unwind functions, a wallet, an execution mode (auto or manual), and the user’s asset allocations.
Sessions persist across execution cycles — your run function is called repeatedly at intervals, not just once.
Session Lifecycle
Execution Flow
Each time your agent executes:- Circuit sends a
runorunwindcommand to your agent - The SDK creates a fresh
AgentContextwith session data - Your
runfunction is called with theAgentContext - Your code executes using SDK methods
- Results are returned to Circuit
- In manual mode, any transactions become suggestions for user approval in the UI
The Run Loop
Circuit calls yourrun function on a recurring interval defined by runtimeIntervalMinutes in circuit.toml:
schedule = "rolling"), the interval starts after the previous run completes — not from the start of execution. If you set schedule = "fixed" in circuit.toml, runs align to clock boundaries instead (e.g. every 60 minutes at :00, every 15 minutes at :00, :15, :30, and :45). Each cycle is independent: your function receives a fresh AgentContext each time. To persist state between cycles, use Memory.
Run Function
Unwind Function
Called when a user wants to unwind. It receives the positions to close, which may be a subset of total holdings.unwind completes, the session ends.
Modes
Configured viaallowedExecutionModes in circuit.toml:
auto— Transactions execute immediatelymanual— Transactions become suggestions for user approval
suggested and suggestionId fields.
For full details on modes, see Manual vs Auto Mode.
Pausing and Resuming
Users can pause a running agent from the Circuit dashboard. While paused:- The session stays open and asset allocations remain in place
- No
runcycles are executed — the agent is effectively idle - Memory and session state are preserved
Key Points
- Multiple agents per wallet — a wallet can run different agents simultaneously. However, the same agent cannot run twice on the same wallet.
- Hyperliquid restriction — only one Hyperliquid agent per wallet (to safely manage shared margin). Other (non-Hyperliquid) agents can still run on that wallet.
- Session memory persists across
runcycles within a session, but is cleared when the session ends. currentPositionsreflects balances at the start of eachrunexecution — not live balances.- Uncaught exceptions in
runorunwindare caught by the SDK automatically. The execution is marked as failed and the error is logged.
See Also
- Agent Context — Session data and SDK methods available in your functions
- Wallets & Asset Allocation — How assets are allocated to sessions
- Manual vs Auto Mode — Detailed mode comparison and suggestion lifecycle
- Memory — Persist state between
runcycles