Integrate an AI Agent
The full human-operated agent flow, request by request.
This is the reference integration for the primary Superior user: an AI agent operated by a human. It expands the Quick Start into the complete decision loop, including the parts where the human belongs in it.
Division of labor#
| The human does | The agent does |
|---|---|
| Provides their email, relays one OTP | Everything else over HTTP |
| Funds the managed wallet | Discovers markets, researches, backtests, deploys, monitors |
| Decides how much capital to expose | Operates strictly inside the managed wallet balance |
The design keeps irreversible acts — spending money, signing with a master key — on the human side, and everything repeatable on the agent side.
The loop#
Onboard (once):
POST /account/registerwith the operator's email → operator reads the six-digit code aloud →POST /account/verify→ the agent storesapi_key: st_live_…. No dashboard needed.- Operator funds the managed wallet. BYOK handoff with a scoped trading key is coming soon. The agent can confirm funding via the deployment's
venue_accountreadiness probe rather than asking.
Research (repeatable):
GET /context/venues→ pick the venue matching the operator's setup.GET /context/markets?query=BTC%20perpetual&limit=100→ search the tradable universe, then select results withbacktest_ready: truefor validation.GET /context/candles,GET /context/funding,GET /context/scan→ form a thesis with actual data. Theevidencefields exist so the agent weighs numbers, not vibes.
Validate (gate):
POST /runtime/backtests→ poll → judge againstmarket_change_pct, drawdown, trade count. A strategy that can't beat the market it trades in doesn't proceed. Zero-trade results: read the logs — an entry condition that never fires is a finding, not a formality.- Deploy
"mode": "paper"where the venue supports it (freqtrade venues at launch) and let a few days of live data test the strategy; where paper isn't available yet, substitute a short, small,alive_until-bounded live run. Compare metrics to the backtest either way.
Execute (bounded):
- Deploy
"mode": "live"with managed credentials andalive_untilset. Start. Report the deployment ID to the operator. - Poll
GET /runtime/deployments/:id+/metricson a sane cadence (minutes). Log summaries where the operator can read them.
Stand down (always reachable):
PUT /runtime/deployments/:id/statuswith{ "action": "stop" }on operator request, onalive_until, or on the agent's own risk rule.DELETE(after positions close) destroys the key material.
Reading these docs programmatically#
The docs themselves are part of the API surface for agents:
- Every page: raw markdown at
/<path>.md(this page:/guides/agent-integration.md). - The index:
/llms.txt. - Error responses link to the relevant page in a
docs_urlfield — an agent that hitscredentials_missingreceives the URL that explains the fix.
Failure etiquette for agents#
429→ honorretry-after, exactly.400withdetails→ the payload is wrong; fix it, don't retry it.5xx→ back off exponentially; deployments keep running through API blips — the control plane and the runtime are separate on purpose.- Never park credentials in prompts or logs. BYOK is coming soon; when it is enabled, treat scoped venue keys like the toxic material rules treat them.