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.
Create New Agent
Create a new agent project from a template.--language <lang>/-l <lang>: Project language (typescriptorpython). Skips the language prompt.--name <name>/-n <name>: Agent name. Skips the name prompt.--template <template>/-t <template>: Template to use (basic,yield,polymarket,hyperliquid). Skips the template prompt.
- Template selection (basic, yield, polymarket, hyperliquid)
- Language selection (TypeScript or Python)
- Agent name (used to generate the directory name)
- A new directory named after the agent name
- Agent code template (
index.tsormain.py) - Configuration file (
circuit.toml) - Description file (
DESCRIPTION.md) - Dependency file (
package.jsonorpyproject.toml) - TypeScript compiler configuration (
tsconfig.json) for TypeScript projects - AI assistant context files (
AGENTS.mdandCLAUDE.md)
- Prints project directory path and next steps
Run Agent Locally
Test your agent locally by executing itsrunFunction against a wallet from the local encrypted vault.
--hosted to instead route through Circuit’s hosted runtime (sessions, policy, funding, real wallet selection):
--hosted: Execute against the hosted runtime instead of pure local mode. Required for in-IDE agent-builder workflows.--path <path>/-p <path>: Run from a specific agent directory instead of the current directory.--wallet <address>/-w <address>: Pick a specific wallet from the keystore (local mode) or your hosted wallets (--hosted) by address.--keystore <path>: (Local mode) override the keystore vault file location. Defaults to~/.config/circuit/keystore.enc.--mode <mode>/-m <mode>: (--hostedonly) Set the execution mode (autoormanual). Defaults to the first entry inallowedExecutionModes.--amount <amount>/-a <amount>: (--hostedonly) Token amount to allocate in smallest unit (should be greater thanminimumAmount).--env KEY=VALUE/-e KEY=VALUE: Override/add env vars for this run (repeatable). Merged with.envfile; CLI flags take precedence.--setting KEY=VALUE/-s KEY=VALUE: Override a setting value defined incircuit.toml(repeatable). See Settings below.--local-sdk-dependencies/-l: Skip automatic dependency installation before running.
- Unlocks the keystore vault (password prompt) and picks a wallet that matches the agent’s
walletType— single match implicit, multiple match interactive picker, or--wallet <address>to bypass. - Builds local primitives — viem-based EVM signer (or, for hosted-wallet vault entries, a permit-bearer-authed signer that calls
/v1/sign), filesystem-backed logs/memory at<projectDir>/.circuit/. - Loads environment variables from
.envand--envoverrides. - Resolves settings from
circuit.tomldefaults and--settingoverrides. - Imports the agent module and calls its
runFunction(agent)directly in-process. - Streams agent logs to stderr.
--hosted):
- Loads environment variables from
.envand--envoverrides - Resolves settings from
circuit.tomldefaults and--settingoverrides - Prompts you to select a wallet from your imported wallets (or uses
--walletflag) - Uploads your latest agent code (soft publish)
- Warns if the
versionincircuit.tomlhas not been bumped since the last publish (skipped on first publish) - Checks for an existing session or creates a new one
- Validates starting asset balance
- Starts the agent server locally with env vars and settings injected
- Sends an execute request with session data
- Streams logs to your terminal
- Stops the server process after execution completes
circuit dev run --hosted stages the exact file set that would be uploaded for deploy into <agent-dir>/.circuit/ before starting the agent. Treat .circuit as a reserved CLI-managed directory and do not place agent source files there or point filesToInclude into it.
Soft publish: In hosted mode, step 4 uploads your code to Circuit for the dev session only. Unlike circuit publish, a soft publish does not create a new versioned release — it temporarily makes your latest code available for the local execution.
Version warning: If the version in your circuit.toml is not newer than the latest published version on Circuit, you’ll see a warning reminding you to bump the version before your next circuit publish. This is a warning only — it does not block the run. In --format json mode, the warning is surfaced as a versionWarning object with localVersion and latestVersion fields.
For details on how runFunction and unwindFunction are called, see Execution Model.
Unwind Agent
Execute your agent’sunwindFunction to close out positions.
unwindFunction locally with empty positions — the agent’s unwind logic discovers what to close from on-chain state via the local RPC. Pass --hosted to instead read open positions from a running hosted session and close them through Circuit’s policy/signing path:
--hosted: Execute against the hosted runtime instead of pure local mode.--path <path>/-p <path>: Run from a specific agent directory instead of the current directory.--wallet <address>/-w <address>: (--hostedonly) Specify the wallet address to unwind instead of being prompted.--env KEY=VALUE/-e KEY=VALUE: Override/add env vars for this unwind (repeatable). Merged with.envfile; CLI flags take precedence.--setting KEY=VALUE/-s KEY=VALUE: Override a setting value defined incircuit.toml(repeatable). See Settings below.--local-sdk-dependencies/-l: Skip automatic dependency installation before running.
--hosted):
- Loads environment variables from
.envand--envoverrides - Resolves settings from
circuit.tomldefaults and--settingoverrides - Fetches your imported wallets that have active sessions for this agent
- Prompts you to select a wallet (or uses
--walletflag) - If multiple sessions exist for the wallet, prompts you to select one
- Fetches current positions for the session
- Starts the agent server locally with env vars and settings injected
- Sends an unwind request with session data and positions
- Streams logs to your terminal
- Ends the session after unwind completes
Settings
circuit dev run and circuit dev unwind inject your circuit.toml settings into the agent context. Default values for optional settings are included automatically — no flags needed.
Settings marked required = true in circuit.toml have no default value. You must provide them via --setting on every invocation — both commands will fail if any required settings are missing and no --setting override is provided.
To override individual values for a single invocation, use --setting KEY=VALUE (repeatable):
circuit.toml default (if optional) → --setting override. Required settings have no default and must be provided via --setting.
The CLI validates overrides against your circuit.toml definitions:
- Unknown keys are rejected
- Values are type-checked (e.g.,
booleansettings only accepttrue/false) single_selectvalues must be one of the definedoptionsaddressvalues are validated for the agent’s wallet type
circuit dev unwind separately requires repeating the same --setting flags — otherwise TOML defaults are used. This matches --env behavior: .env is the persistent layer for env vars, circuit.toml defaults are the persistent layer for settings.
Validate Agent Project
Validate your agent project configuration and files offline — no authentication required.--format <mode>/-f <mode>: Output format:text(default),json(structured result), orstream-json(NDJSON events).--path <path>/-p <path>: Path to agent project directory (defaults to current directory).--env KEY=VALUE/-e KEY=VALUE: Override/add env vars for validation (repeatable). Merged with.envfile; CLI flags take precedence.
- Config structure (valid
circuit.toml) - Entry point exists (
index.tsormain.py) - Handler export (
agent.getExport()oragent.get_handler()) - SDK version pinning
- Environment variable cross-referencing
- Files to upload listing
- TypeScript typecheck via project
tsconfig.json, or Python syntax check
Global Flags
The CLI parser supports these global flags:--path <path>/-p <path>: Path to agent project directory (defaults to current directory).--format <mode>/-f <mode>: Output format:text(default),json(structured result), orstream-json(NDJSON events).--help/-h: Show help for the command.