Agent Safety
Operational safety guidance for Master wallets, Agent wallets, and automated trading systems.
Last updated
Operational safety guidance for Master wallets, Agent wallets, and automated trading systems.
AFX separates account control from day-to-day trading by using two wallet roles.
Master wallet
Holding funds, approving Agents, revoking Agents, account withdrawals
Automated trading runtimes, bots, CI jobs, or hosted agent environments
Agent wallet
Placing/canceling orders, setting leverage, margin mode, and other authorized trading actions
Account withdrawals or long-lived custody of user funds
Never place the Master private key in an automated trading process. The Master wallet controls funds and Agent authorization.
Create a dedicated Agent wallet for each bot or strategy.
Approve the Agent from the Master wallet with the shortest practical validity period.
Store only the Agent private key in the trading runtime.
Query product metadata before choosing symbols, product codes, leverage, precision, or order size.
Keep an operational runbook for canceling orders and revoking the Agent.
Use revocation when rotating keys, stopping a strategy, or responding to suspected key exposure.
from afx import AfxClient
client = AfxClient.from_env(testnet=True)
client.exchange.revoke_agent(agent_name="my-bot")Under the hood, revocation submits an approveAgent action with the zero address:
Stop the old bot process.
Revoke the old Agent.
Create a new Agent wallet.
Approve the new Agent from the Master wallet.
Restart the bot with only the new Agent key.
Verify account state, open orders, and positions before resuming normal sizing.
Vault actions are not the same risk class as ordinary order placement.
Trading on the Master account
Agent actions can change market exposure but cannot withdraw account funds to an external address.
Vault-context actions
A vault-authorized Agent may affect vault balances, ownership, withdrawal flow, or vault lifecycle depending on the action.
Account withdrawals
Master-signed operation. Keep this outside automated trading infrastructure.
Before granting automated access to vault workflows, review the exact operation and confirm the intended authority boundary for that vault.
Run new agents on testnet before mainnet:
Claim testnet funds.
Approve an Agent wallet.
Query GET /info/public/product-meta.
Place a small limit order away from market.
Cancel the order.
Revoke or rotate the Agent if the environment was temporary.
Last updated
{
"type": "approveAgent",
"agentAddress": "0x0000000000000000000000000000000000000000",
"validitySeconds": 0
}
