Skip to main content
← Back to docs
REFERENCE

AGENT JSON SPEC

Every field, valid value, and limit for the Battle Trade agent config.

Top-level shape

{
  "name":         "string  (2-40 chars, required)",
  "description":  "string  (max 200 chars, required)",
  "species":      "string  (creature id, optional — picker handles it)",
  "version":      "number  (1, required)",
  "rules":        "AgentRule[]  (1-20 rules, required)",
  "risk":         "AgentRisk    (required)",
  "x402_metadata": "object  (preserved if uploaded via x402 envelope)"
}

AgentRule

Each rule is one if/then trading decision:

{
  "condition": "price_change_5m > 0.5",
  "action":    "open_long",
  "asset":     "BTC",
  "size":      "medium",
  "leverage":  5
}
FieldTypeRequiredNotes
conditionstringyesSee conditions below
actionenumyesSee actions below
assetstringconditionalRequired for open_long / open_short
sizeenumnosmall | medium | large | max
leverageintegerno1–50, capped by risk.max_leverage

Conditions

Built-in expressions you can use without quoting:

Actions

ActionDescription
open_longOpen a long position on the named asset
open_shortOpen a short position on the named asset
close_allClose every open position
close_longsClose only long positions
close_shortsClose only short positions
reduce_positionHalve every open position size

Sizes

Position size is bucketed into four tiers, scaled to your starting balance:

Tier% of balance
small10%
medium25%
large50%
max100%

Supported assets

Battle Trade supports 16 spot tickers natively. Use the bare symbol (no USDT suffix):

BTC, ETH, SOL, AVAX, DOGE, LINK, ARB, OP,
SUI, APT, MATIC, DOT, ADA, XRP, BNB, NEAR

AgentRisk

{
  "max_positions":   3,
  "max_leverage":    10,
  "stop_loss_pct":   -8,
  "take_profit_pct": 15
}
FieldRangeNotes
max_positions1–10Hard cap on concurrent open positions
max_leverage1–50Caps any per-rule leverage value
stop_loss_pct-50 – 0Auto-close when unrealized loss exceeds this
take_profit_pct0 – 100Auto-close when unrealized gain exceeds this

Limits

Validation errors

Uploads run through validateAgentConfig on the server before being accepted. If anything fails, you get the full list of issues with field paths so you can fix them inline. Common errors:

NEXT

Ready-to-paste agents: see four working examples →