AI agents API

Agents, versions, sessions and traces. 29 ops: list_agents, get_agent, get_agent_config_schema, create_agent, update_agent, promote_agent_version, rollback_agent, deploy_agent, undeploy_agent, archive_agent, set_agent_secret, list_agent_secrets, delete_agent_secret, test_agent, suggest_reply, list_a

Agents, versions, sessions and traces.

List AI agents · POST /api/v1/list_agents · scope agents:read or GET …?input=

The organization's AI agents with their status, production and test version ids and the phone numbers each answers (deployments). Archived agents are left out unless include_archived.

curl -X POST https://getwabi.dev/api/v1/list_agents \  -H "Authorization: Bearer wabi_…"

Get an AI agent · POST /api/v1/get_agent · scope agents:read or GET …?input=

One agent: its summary, deployments, every version (stage, model, notes) and the configuration of the open draft, test and production versions. Use it before update_agent or promote_agent_version.

curl -X POST https://getwabi.dev/api/v1/get_agent \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"agent_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10"}'

Get the agent configuration schema · POST /api/v1/get_agent_config_schema · scope agents:read or GET …?input=

The JSON Schema of an agent version's configuration (model, instructions, knowledge, tools and their permissions, escalation and approval policies, language and style, budgets, turn and timeout limits), the models agents can use and the default configuration. Read it before writing a config for create_agent or update_agent.

curl -X POST https://getwabi.dev/api/v1/get_agent_config_schema \  -H "Authorization: Bearer wabi_…"

Create an AI agent · POST /api/v1/create_agent · scope agents:write

Creates an agent with version 1 as an open draft. Give it a name and a config (or start from the defaults and update_agent later). Next: add knowledge (add_knowledge_source), try it (test_agent), promote_agent_version to test, deploy_agent to the sandbox number, then promote to production. Returns the agent and its draft.

curl -X POST https://getwabi.dev/api/v1/create_agent \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"name":"Support"}'

Update an AI agent · POST /api/v1/update_agent · scope agents:write

Renames an agent or changes its configuration. Config changes go to the open draft (one is created from the latest version when none is open); test and production versions never change: promote the draft to ship it. config is merged into the draft (objects deep-merged, arrays replaced) unless replace_config.

curl -X POST https://getwabi.dev/api/v1/update_agent \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"agent_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10"}'

Promote an agent version · POST /api/v1/promote_agent_version · scope agents:write

Ships a version: to test (the draft becomes the test environment's version: the sandbox number and test chats), or to production (a test version becomes what live numbers answer with; a draft needs skip_test: true). The version is frozen from then on; earlier production versions stay available for rollback_agent. Running sessions keep the version they started with.

curl -X POST https://getwabi.dev/api/v1/promote_agent_version \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"agent_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10","version_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10","to":"test"}'

Roll back an agent · POST /api/v1/rollback_agent · scope agents:write

Puts an earlier production version back in production: the one before the current, or version_id. New sessions use it at once.

curl -X POST https://getwabi.dev/api/v1/rollback_agent \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"agent_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10"}'

Deploy an agent to a number · POST /api/v1/deploy_agent · scope agents:write

Makes a phone number answer with this agent: environment test (the sandbox number only) or production. Replaces any agent the number had. Inbound messages are answered from the agents' queue within seconds; a conversation a person took over is left to them. The sandbox number is free on every plan; a live number needs Starter or higher.

curl -X POST https://getwabi.dev/api/v1/deploy_agent \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"agent_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10","phone_number_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10"}'

Remove the agent from a number · POST /api/v1/undeploy_agent · scope agents:write

The phone number stops answering with an agent; people answer in the inbox. Sessions already running finish their current turn.

curl -X POST https://getwabi.dev/api/v1/undeploy_agent \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"phone_number_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10"}'

Archive an AI agent · POST /api/v1/archive_agent · scope agents:write

Retires an agent: removes it from every number and hides it from lists. Its sessions, traces and versions are kept.

curl -X POST https://getwabi.dev/api/v1/archive_agent \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"agent_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10"}'

set_agent_secret

writeowner or admin

Set an agent secret · POST /api/v1/set_agent_secret · scope agents:write

Stores a credential agents use, encrypted: model_key (your Anthropic key, BYO on Growth+), slack_webhook (a Slack incoming webhook URL), http_secret (signing secret for a custom HTTP tool), mcp_token (bearer token of an external MCP server). Versions refer to it by name; setting an existing name replaces the value. The value is never returned.

curl -X POST https://getwabi.dev/api/v1/set_agent_secret \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"name":"Support","kind":"model_key","value":"value"}'

List agent secrets · POST /api/v1/list_agent_secrets · scope agents:read or GET …?input=

The names, kinds and last four characters of the organization's agent secrets (never the values).

curl -X POST https://getwabi.dev/api/v1/list_agent_secrets \  -H "Authorization: Bearer wabi_…"

delete_agent_secret

writeowner or admin

Delete an agent secret · POST /api/v1/delete_agent_secret · scope agents:write

Revokes a secret. Tools and model keys that name it fail closed (the agent hands off) until it is set again.

curl -X POST https://getwabi.dev/api/v1/delete_agent_secret \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"name":"Support"}'

Test chat with an agent · POST /api/v1/test_agent · scope agents:write

Runs one agent turn on a conversation you write, without messaging anyone: the draft (default), test or production version answers the last customer message. Returns the decision (respond, approve or escalate), the reply, the sources it cited, the computed confidence and checks, tool calls (tools that change things are simulated unless allow_side_effects) and tokens, cost and latency; the trace is in the session explorer (channel test). mocks replaces tool outputs: {"<tool name>": <output>}.

curl -X POST https://getwabi.dev/api/v1/test_agent \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"agent_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10"}'

Suggest a reply · POST /api/v1/suggest_reply · scope agents:write

For a person answering in the inbox: drafts a reply to the customer's latest messages in a conversation with sources, confidence and what the agent would have done (recommended: respond, approve or escalate). Nothing is sent. Uses the agent on the conversation's number (its production version, or test on the sandbox), or agent_id. Counts as an AI reply on the platform's model key.

curl -X POST https://getwabi.dev/api/v1/suggest_reply \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"conversation_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10"}'

List agent approvals · POST /api/v1/list_agent_approvals · scope agents:read or GET …?input=

Drafted replies and tool calls agents are holding for a person (status pending by default), with the reason, the draft, its sources and confidence. Decide them with decide_agent_approval.

curl -X POST https://getwabi.dev/api/v1/list_agent_approvals \  -H "Authorization: Bearer wabi_…"

Approve or reject an agent action · POST /api/v1/decide_agent_approval · scope agents:write

Approves (sends the reply, optionally with your edited text, or runs the held tool call) or rejects an agent's pending action. Returns the approval with its result.

curl -X POST https://getwabi.dev/api/v1/decide_agent_approval \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"approval_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10","approve":false}'

List agent sessions · POST /api/v1/list_agent_sessions · scope agents:read or GET …?input=

The session explorer's list, newest first: each session's agent and version, conversation, channel (whatsapp, test, api, eval), status, resolution, stop and escalation reasons, turns, tokens, cost and timings. get_agent_session has the full trace.

curl -X POST https://getwabi.dev/api/v1/list_agent_sessions \  -H "Authorization: Bearer wabi_…"

Get an agent session trace · POST /api/v1/get_agent_session · scope agents:read or GET …?input=

One session's full trace: every turn with its input, reply, decision, intent, sources retrieved and cited, checks and computed confidence, tool calls (input, output, status, latency, cost, MCP server), tokens, cost, latency, errors and retries, plus approvals, evaluations, stop and escalation reasons and the handoff packet.

curl -X POST https://getwabi.dev/api/v1/get_agent_session \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"session_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10"}'

Get agent metrics · POST /api/v1/get_agent_metrics · scope agents:read or GET …?input=

Observability for one agent or all of them over the last `days`: sessions, active sessions, error rate, tokens, model and tool cost, turns per session, execution time, resolution, agent-contained resolution, escalation and human-intervention rates, evidence-supported answer rate, CSAT, cost per resolved issue, p50/p90/p95/p99 of turns, execution time, time to first response, tokens, model and tool latency, and per-tool analytics (calls, success rate, errors, timeouts, permission denials, p50/p95 latency, cost).

curl -X POST https://getwabi.dev/api/v1/get_agent_metrics \  -H "Authorization: Bearer wabi_…"

Add a golden-answer eval case · POST /api/v1/create_eval_case · scope agents:write

Adds (or replaces, by suite and name) a test case to an agent's golden suite: a conversation, what the reply must and must not contain, the decision expected (respond, approve, escalate), tools that must or must not be called, a minimum confidence, and mocked tool outputs. Run the suite with run_eval_suite.

curl -X POST https://getwabi.dev/api/v1/create_eval_case \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"agent_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10","name":"Support","input":{"messages":[{"role":"customer","text":"Hi, where is my order?"}]}}'

List eval cases · POST /api/v1/list_eval_cases · scope agents:read or GET …?input=

An agent's golden-answer cases, optionally one suite, and the result of each suite's latest run.

curl -X POST https://getwabi.dev/api/v1/list_eval_cases \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"agent_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10"}'

Delete an eval case · POST /api/v1/delete_eval_case · scope agents:write

Removes a case from an agent's golden-answer suite; future run_eval_suite runs skip it. Results of past runs are kept.

curl -X POST https://getwabi.dev/api/v1/delete_eval_case \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"case_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10"}'

Run a golden-answer suite · POST /api/v1/run_eval_suite · scope agents:write

Runs every case of a suite against a version (the draft by default) with mocked tools, in the background; results appear in list_eval_cases (runs) and get_eval_run within a minute or two. Tools that change things never run. Growth plan and up.

curl -X POST https://getwabi.dev/api/v1/run_eval_suite \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"agent_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10"}'

Get an eval run · POST /api/v1/get_eval_run · scope agents:read or GET …?input=

The results of one run_eval_suite run: each case passed or failed, with every check, the reply, the decision, the confidence, cost and latency, and the session to open in the explorer.

curl -X POST https://getwabi.dev/api/v1/get_eval_run \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"agent_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10","suite":"suite","run_id":"run_id"}'

Replay a conversation against a version · POST /api/v1/replay_conversation · scope agents:write

Runs a past conversation's customer turns again against a version (the draft by default), with tools mocked or read-only (nothing is sent, nothing changes), and returns each step side by side: what the customer wrote, what was actually sent and by whom, and what this version would reply, decide, cite and cost. Use it before promoting a change. Growth plan and up.

curl -X POST https://getwabi.dev/api/v1/replay_conversation \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"agent_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10","conversation_id":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10"}'

Audit recent conversations · POST /api/v1/audit_conversations · scope agents:write

Conversation intelligence: analyzes the organization's conversations of the last since_hours (up to 150, newest first) with their agent sessions and failed tool calls. Counts outcomes (resolved, escalated, unanswered, open), escalation reasons and failing tools, then classifies each conversation's intent and outcome, finds recurring unresolved patterns and why they stay unresolved, documentation gaps (with an article to write), tool issues, and recommends knowledge, workflow and agent changes. Runs in the background (get_conversation_audit) unless wait: true, which answers directly for up to 60 conversations.

curl -X POST https://getwabi.dev/api/v1/audit_conversations \  -H "Authorization: Bearer wabi_…"

Get a conversation audit · POST /api/v1/get_conversation_audit · scope agents:read or GET …?input=

One audit: status (running, completed, failed), period, conversations analyzed and the report (outcomes, intents, escalation reasons, failed tools, unresolved patterns, documentation gaps, tool issues, recommendations, per-conversation classification). Omit audit_id for the latest.

curl -X POST https://getwabi.dev/api/v1/get_conversation_audit \  -H "Authorization: Bearer wabi_…"

List conversation audits · POST /api/v1/list_conversation_audits · scope agents:read or GET …?input=

Past conversation audits, newest first, without their reports (get_conversation_audit has one).

curl -X POST https://getwabi.dev/api/v1/list_conversation_audits \  -H "Authorization: Bearer wabi_…"