Capabilities and limits
Recommended lifecycle
1
Create a dedicated wallet
Generate a new wallet for one strategy, service, or environment. Store its private key in a KMS, HSM, or secrets manager and expose only a narrow signing interface to the trading service.
2
Approve it from the master account
Submit
approveAgent, signed by the master account. Prefer a descriptive agentName and a finite validUntil for production automation.3
Verify the authorization
Query
userAgents with the master account ID and confirm the returned address, name, expiry, and slot type before enabling the signer.4
Sign only validated actions
The strategy or model should produce an unsigned intent. A deterministic policy layer validates the action, applies risk controls, assigns a unique nonce, and sends the canonical payload to the agent signer.
5
Monitor and reconcile
Track open orders and fills through the Read API and private WebSocket channels. Stop submitting new writes when authorization is near expiry, state is stale, or reconciliation falls behind.
6
Rotate or revoke
Approve the replacement wallet, verify it, switch the signer, and then call
revokeAgent for the old address. Maintain a separate operator-controlled kill switch that can revoke the active agent without relying on the strategy process.Agent execution envelope
Every state-changing operation usesPOST /exchange and follows the standard signing process documented in Authentication. The nonce must be unique for the agent signing address, not merely for the master account.
When using the documented proxy or vault flow, include the target vaultAddress at the top level. The server verifies that the recovered signer is authorized for that target.
Build and sign the exact action shape defined by the relevant Write API page. Do not let a model invent action fields, infer numeric types, or sign arbitrary JSON.
Separate reasoning from signing
A secure agent stack should have distinct responsibilities:Context and planning
Reads documentation and current state, then proposes a structured action with a rationale. It has no access to private keys.
Policy engine
Enforces allowed actions, contract allowlists, precision, maximum size, leverage, reduce-only constraints, price bands, and account-level exposure limits.
Signer
Accepts only validated canonical actions, assigns or verifies a unique nonce, signs with the agent key, and returns the signature envelope.
Reconciler
Confirms orders, cancellations, fills, positions, and authorization state from server responses and WebSocket events.
Expiry and rotation policy
For production systems, avoid permanent authorization unless there is a strong operational reason. A practical policy is:- Use a named agent for each environment and strategy, such as
maker-prodorrisk-staging. - Set a finite
validUntiland alert well before expiry. - Create and approve a replacement wallet before the current authorization expires.
- Verify the replacement through
userAgents. - Switch the signer and run a low-risk health check.
- Revoke the previous address and confirm it is no longer used by any process.
userAgents includes expired entries, your monitoring should distinguish validUntil = 0, future timestamps, and expired timestamps rather than assuming every returned record is active.
Kill switch
A kill switch should operate independently of the model and trading strategy:- Stop the order-generation loop.
- Disable or isolate the signing service.
- Cancel open orders where operationally appropriate.
- Revoke the agent with
revokeAgent, signed by the master account. - Confirm authorization state through
userAgents. - Reconcile late responses and in-flight requests before declaring the incident closed.
Common failure modes
Related API pages
approveAgent
Authorize an agent address, name it, and optionally set an expiry.
revokeAgent
Remove an agent authorization and free its quota slot.
userAgents
Audit active and expired agent records for a master account.
Authentication
Sign
POST /exchange requests with EIP-712 over secp256k1 — Agent and typed paths.Nonce
Generate unique replay-protection values for each signing address.
Write requests
Review the shared
POST /exchange envelope and proxy fields.