> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eluup.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure Agent Risk and Trading Parameters

> Adjust risk controls, signal confidence thresholds, and position limits on an ELUUP AI trading agent using PATCH /agents/{id}.

You can update an agent's behavior at any time by calling [PATCH /agents/](/api-reference/agents/update-agent){id}. The most important configuration is the `risk` object, which controls how large each position is and how the agent protects downside. You can also tune the signal filter and the maximum number of concurrent positions.

## Configurable Fields

<ParamField body="name" type="string">
  Display name for the agent. This does not affect trading behavior.
</ParamField>

<ParamField body="risk.position_size_pct" default="0.05" type="number">
  Fraction of available wallet balance to allocate per trade. Valid range: `0.01` to `0.25`.

  <br />

  Example: `0.05` means each trade uses 5% of the wallet's available balance.
</ParamField>

<ParamField body="risk.stop_loss_pct" default="0.07" type="number">
  Maximum loss, expressed as a fraction of entry price, before the position is closed. Valid range: `0.02` to `0.20`.

  <br />

  Example: `0.07` closes the position if the price drops 7% below entry.
</ParamField>

<ParamField body="risk.trailing_stop_pct" default="0.04" type="number">
  Distance below the highest price reached during the trade before a trailing-stop exit fires. Valid range: `0.01` to `0.15`.

  <br />

  Example: if the token rises 30% and then falls 4% from its peak, the trailing stop closes the position.
</ParamField>

<ParamField body="risk.take_profit_pct" default="0.20" type="number">
  Profit target at which the position is closed automatically. Valid range: `0.05` to `1.00`.

  <br />

  Example: `0.20` takes profit when the price rises 20% above entry.
</ParamField>

<ParamField body="min_confidence" default="0.70" type="number">
  Minimum signal confidence required for the agent to act. Valid range: `0.50` to `1.00`.

  <br />

  Higher values reduce trade frequency and focus the agent on the highest-probability setups.
</ParamField>

<ParamField body="max_positions" default="3" type="integer">
  Maximum number of open positions the agent will hold at once. Valid range: `1` to `10`.

  <br />

  Once this limit is reached, the agent will skip new signals until an existing position closes.
</ParamField>

## Example: Update an Agent

The following request changes the agent's position size and tightens the stop loss:

<CodeGroup>
  ```bash curl theme={null}
  curl -X PATCH https://api.eluup.ai/v1/agents/agent_7xK3mNpQvL9wYzB2 \
    -H "Authorization: Bearer $ELUUP_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Base Alpha Agent - Aggressive",
      "risk": {
        "position_size_pct": 0.10,
        "stop_loss_pct": 0.05,
        "trailing_stop_pct": 0.04,
        "take_profit_pct": 0.25
      },
      "min_confidence": 0.75,
      "max_positions": 5
    }'
  ```

  ```typescript TypeScript theme={null}
  const response = await fetch("https://api.eluup.ai/v1/agents/agent_7xK3mNpQvL9wYzB2", {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.ELUUP_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      name: "Base Alpha Agent - Aggressive",
      risk: {
        position_size_pct: 0.10,
        stop_loss_pct: 0.05,
        trailing_stop_pct: 0.04,
        take_profit_pct: 0.25,
      },
      min_confidence: 0.75,
      max_positions: 5,
    }),
  });

  const updated = await response.json();
  ```

  ```python Python theme={null}
  import os, requests

  updated = requests.patch(
      "https://api.eluup.ai/v1/agents/agent_7xK3mNpQvL9wYzB2",
      headers={
          "Authorization": f"Bearer {os.environ['ELUUP_API_KEY']}",
          "Content-Type": "application/json",
      },
      json={
          "name": "Base Alpha Agent - Aggressive",
          "risk": {
              "position_size_pct": 0.10,
              "stop_loss_pct": 0.05,
              "trailing_stop_pct": 0.04,
              "take_profit_pct": 0.25,
          },
          "min_confidence": 0.75,
          "max_positions": 5,
      },
  ).json()
  ```
</CodeGroup>

## Example Response

```json theme={null}
{
  "id": "agent_7xK3mNpQvL9wYzB2",
  "name": "Base Alpha Agent - Aggressive",
  "wallet_id": "wallet_2nQ9xLpR3vK8wYzA",
  "chain_id": 8453,
  "state": "active",
  "min_confidence": 0.75,
  "max_positions": 5,
  "risk": {
    "position_size_pct": 0.10,
    "stop_loss_pct": 0.05,
    "trailing_stop_pct": 0.04,
    "take_profit_pct": 0.25
  },
  "open_positions_count": 2,
  "total_trades": 18,
  "win_rate": 0.78,
  "total_pnl_usd": 1247.50,
  "created_at": "2024-06-15T09:23:00Z",
  "updated_at": "2024-06-15T14:45:00Z"
}
```

<Warning>
  Changing `risk` parameters on an active agent affects future trades immediately, but does not retroactively adjust open positions. If you want existing positions to follow new stop or take-profit levels, close them first or pause the agent and restart after the update.
</Warning>

## Recommended Risk Profiles

You can tune the agent to match your risk tolerance. Here are three common profiles:

| Profile      | position\_size\_pct | stop\_loss\_pct | trailing\_stop\_pct | take\_profit\_pct | min\_confidence |
| ------------ | ------------------- | --------------- | ------------------- | ----------------- | --------------- |
| Conservative | 0.03                | 0.05            | 0.02                | 0.10              | 0.80            |
| Balanced     | 0.05                | 0.07            | 0.04                | 0.20              | 0.70            |
| Aggressive   | 0.10                | 0.10            | 0.05                | 0.30              | 0.65            |
