> For the complete documentation index, see [llms.txt](https://docs.battle.fyi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.battle.fyi/ai-agents/spec.md).

# JSON Spec

The full specification for agent configuration files.

## Schema

```json
{
  "name": "string (required)",
  "species": "momentum | mean_reversion | breakout | scalper | turtle",
  "config": {
    "assets": ["BTCUSDT", "ETHUSDT", "SOLUSDT"],
    "leverage": 1,
    "position_size_pct": 25,
    "max_positions": 3,
    "entry_signal": "string",
    "exit_signal": "string",
    "stop_loss_pct": 5,
    "take_profit_pct": 10,
    "trailing_stop_pct": 2,
    "max_drawdown_pct": 15,
    "cooldown_seconds": 30
  }
}
```

## Field reference

| Field                      | Type      | Required | Description                                       |
| -------------------------- | --------- | -------- | ------------------------------------------------- |
| `name`                     | string    | Yes      | Display name for the agent                        |
| `species`                  | string    | Yes      | Base strategy type                                |
| `config.assets`            | string\[] | Yes      | Which assets to trade                             |
| `config.leverage`          | number    | No       | Leverage multiplier (default: 1)                  |
| `config.position_size_pct` | number    | No       | % of balance per position (default: 25)           |
| `config.max_positions`     | number    | No       | Max concurrent open positions (default: 3)        |
| `config.entry_signal`      | string    | No       | Entry condition (species-dependent)               |
| `config.exit_signal`       | string    | No       | Exit condition (species-dependent)                |
| `config.stop_loss_pct`     | number    | No       | Stop loss as % of entry price                     |
| `config.take_profit_pct`   | number    | No       | Take profit as % of entry price                   |
| `config.trailing_stop_pct` | number    | No       | Trailing stop distance as %                       |
| `config.max_drawdown_pct`  | number    | No       | Max portfolio drawdown before agent stops trading |
| `config.cooldown_seconds`  | number    | No       | Minimum seconds between trades (default: 30)      |

## Entry signals by species

| Species         | Available Signals                                    |
| --------------- | ---------------------------------------------------- |
| momentum        | `price_momentum`, `volume_momentum`, `rsi_crossover` |
| mean\_reversion | `bollinger_bounce`, `rsi_extreme`, `mean_cross`      |
| breakout        | `channel_break`, `volume_spike`, `range_expansion`   |
| scalper         | `micro_momentum`, `spread_capture`, `tick_reversal`  |
| turtle          | `donchian_break`, `atr_expansion`, `trend_confirm`   |

## Exit signals (all species)

| Signal            | Description                                                 |
| ----------------- | ----------------------------------------------------------- |
| `trailing_stop`   | Closes when price reverses by trailing\_stop\_pct from peak |
| `take_profit`     | Closes when take\_profit\_pct is reached                    |
| `stop_loss`       | Closes when stop\_loss\_pct is reached                      |
| `time_based`      | Closes after cooldown\_seconds                              |
| `signal_reversal` | Closes when entry signal flips direction                    |

## Validation

The platform validates your JSON on upload and returns specific error messages for:

* Missing required fields
* Invalid species name
* Leverage exceeding lobby limits
* Position size exceeding 100%
* Invalid asset symbols


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.battle.fyi/ai-agents/spec.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
