🛡️ AgentFlare Docs

POST /config

Set budget thresholds, Slack webhooks, and pause/resume agents.

POST /config

Create or update the configuration for an agent. This sets the daily budget limit and optional Slack webhook. The SDK calls this automatically on startup when you pass cost_threshold to AgentFlare(...).


Request

POST /config
x-api-key: ag_your_key_here
Content-Type: application/json
{
  "agent_id": "my-sales-agent",
  "cost_threshold_usd": 10.0,
  "slack_webhook_url": "https://hooks.slack.com/services/T.../B.../..."
}

Fields

FieldTypeRequiredDefaultDescription
agent_idstringYesThe agent to configure.
cost_threshold_usdfloatNo10.0Daily spend limit in USD. The agent is auto-paused when this is exceeded.
slack_webhook_urlstringNonullSlack incoming webhook URL. A message is sent when the agent is auto-paused.

Response

{ "ok": true }

POST /config/pause

Manually pause or resume an agent. This overrides the threshold — you can pause an agent that hasn't hit its budget, or resume one that has.

POST /config/pause
x-api-key: ag_your_key_here
Content-Type: application/json
{
  "agent_id": "my-sales-agent",
  "is_paused": true
}

Fields

FieldTypeRequiredDescription
agent_idstringYesThe agent to pause or resume.
is_pausedbooleanYestrue to pause, false to resume.

Response

{
  "ok": true,
  "agent_id": "my-sales-agent",
  "is_paused": true
}

How config is stored

Config is stored in the agent_configs table in Supabase. The upsert is keyed on (agent_id, user_id), so calling POST /config twice for the same agent is safe — it updates, not duplicates.


Curl examples

Set threshold:

curl -X POST <your-backend-url>/config \
  -H "x-api-key: ag_your_key" \
  -H "Content-Type: application/json" \
  -d '{"agent_id": "my-agent", "cost_threshold_usd": 5.0}'

Resume a paused agent:

curl -X POST <your-backend-url>/config/pause \
  -H "x-api-key: ag_your_key" \
  -H "Content-Type: application/json" \
  -d '{"agent_id": "my-agent", "is_paused": false}'

On this page