Browse this section
API reference

Agents

Create, version, evaluate, promote and trigger agents.

The agent object

{
  "id": "agt_01j9x5c3d4",
  "name": "invoice-processor",
  "description": "Read supplier invoices, validate, post to accounting.",
  "production_version": 7,
  "latest_version": 8,
  "status": "active",
  "triggers": [ { "type": "email.received", "mailbox": "invoices@" } ],
  "created_at": "2026-06-10T09:00:00Z"
}

Endpoints

MethodPathPurpose
GET/agentsList
POST/agentsCreate from a YAML/JSON definition (creates version 1)
GET/agents/{id}Retrieve
GET/agents/{id}/versionsList versions
POST/agents/{id}/versionsCreate a new version from a definition
GET/agents/{id}/versions/{n}Retrieve a version's definition
POST/agents/{id}/versions/{n}/evaluateRun the evaluation set; returns an evaluation object
POST/agents/{id}/versions/{n}/promotePromote to production (blocked if gate fails)
POST/agents/{id}/runsStart a run (manual trigger) with an input
POST/agents/{id}/triggerWebhook trigger (uses the agent's webhook secret)
POST/agents/{id}/pause / /resumePause or resume triggers
DELETE/agents/{id}Archive

Create

curl -X POST https://api.brewmycode.com/v1/agents \
  -H "Authorization: Bearer $BMC_API_KEY" -H "Content-Type: application/yaml" \
  --data-binary @agent.yaml

See Building an agent for the definition format.

Start a run

curl -X POST https://api.brewmycode.com/v1/agents/agt_01j9x5c3d4/runs \
  -H "Authorization: Bearer $BMC_API_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: inv-2026-0917-0042" \
  -d '{ "input": { "document_url": "https://drive.google.com/file/d/…" }, "mode": "production" }'

mode is production (default for live keys) or test (writes simulated). Returns a run.

Webhook trigger

curl -X POST https://api.brewmycode.com/v1/agents/agt_01j9x5c3d4/trigger \
  -H "X-BMC-Webhook-Secret: whsec_…" -H "Content-Type: application/json" \
  -d '{ "ticket_id": 48213, "subject": "Invoice mismatch" }'