Create a runnable agent repo from a checked template
onchain_agent_create_agentUSE WHEN someone wants the code for an onchain agent, not advice: describe the goal and get a runnable TypeScript repo generated from a template that is re-checked every night. Same handler as POST /api/create and the create-sato-agent CLI.
The goal picks the template; it never changes a template code file. A goal no template answers returns no_template with the nearest templates instead of improvised code — each with its id, framework, intents, chains and mismatched (what differs from the request), so the next call can name one.
TEMPLATES, as template (intents: frameworks): base-guarded-trader (trading, swap: agentkit, ai-sdk, claude-agent-sdk, openai-agents, plain-ts); persona-agent (general, payments: claude-agent-sdk); research-report (data, research: plain-ts); solana-guarded-swapper (trading, swap: plain-ts); token-launch-prep (launch: plain-ts); treasury-monitor (data, treasury: plain-ts); x402-seller (payments: plain-ts). Any other intent × framework pair answers no_template.
The repo carries policy.json (spending caps, allowed chains and tokens), sato.lock.json (dependency custody readings) and sato.create.json (the manifest, signed when a key is configured). It generates for a local fork by default and testnet on request; mainnet is refused unless network is "mainnet" and mainnet_risk_accepted is true, and a template that does not run on the network says so.
RULE ENFORCED: the goal is not stored or logged. A refusal names its error code and, where one applies, the rule. last_green is the day the template last passed its nightly checks, or null — never invented. Nothing is audited, and nothing here signs, holds keys or moves funds.
Returns (json): { schema: "sato.create.response/v1", ok: true, template: { id, version, digest, framework }, files: [{ path, encoding, content }], zip_base64?, env_names, next_commands, manifest, last_green, status_url, cli } or { ok: false, error, message, rule?, nearest?, blocked? }. Writes nothing.
Example: { goal: "swap USDC to ETH on Base with a per-trade cap", framework: "plain-ts" }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| goal | Yes | What the agent should do, in plain words, e.g. 'swap USDC to ETH on Base with a per-trade cap'. Not stored. | |
| chain | No | Chain the agent runs on. | |
| format | No | files (default) or zip (adds zip_base64). | |
| network | No | Where it may sign. Default fork. mainnet needs mainnet_risk_accepted: true. | |
| template | No | Pin a template id. | |
| framework | No | Agent framework. Templates exist for agentkit, ai-sdk, claude-agent-sdk, openai-agents, plain-ts; any other answers no_template with the nearest. | |
| mainnet_risk_accepted | No | Explicit acceptance of mainnet risk. Only read when network is mainnet. |