Skip to main content

Agent Builder API

Beta

The agent builder is part of the Conversational Agents Beta and available on Professional, Scale and Enterprise.

The agent builder drafts a ready-to-review agent from a short brief: a persona, instructions, 1-7 skills and suggested knowledge sources. You review and edit the draft, then create the agent from it.

GET  /agent-builder/estimate        → what a build costs
POST /agent-builder/generate → 202, starts a build job
GET /agent-builder/jobs/{job_id} → poll until succeeded / failed
POST /agent-builder/create → 201, creates the (inactive) agent

Base URL: https://api.sendseven.com/api/v1/automation. All endpoints need the scope automation:create. If AI features are turned off for the workspace, they return 403 with "code": "ai_disabled".

Cost​

A successful build costs 100 AI credits. Failed builds and creating the agent are free.

GET /agent-builder/estimate

{
"credits": 100,
"price_euros": "1.00",
"ai_credit_rate_euros": "0.01",
"billable": true,
"charged_on": "successful_build"
}
FieldNotes
creditsAI credits charged for one successful build
price_euroscredits × your plan's AI credit price
ai_credit_rate_eurosYour plan's price of one AI credit
billablefalse when builds are currently free

The charge appears in your usage as agent_builder (see Billing & limits).

Start a build​

POST /agent-builder/generate

{
"company_name": "Example Shoes",
"website_url": "https://www.example.com",
"goals": ["answer_questions", "orders_shipping", "human_handoff"],
"tone": "friendly",
"base_language": "en",
"language_mode": "auto",
"channel_ids": ["CHANNEL_ID"],
"notes": "Free returns within 30 days. We do not ship outside the EU.",
"ui_language": "en",
"request_id": "build-2026-10-05-001"
}
FieldNotes
company_nameRequired. 1-120 characters.
website_urlOptional, max 510. Only its domain is used, as context. The website is not fetched.
goalsRequired. 1-6 of answer_questions, qualify_leads, support, orders_shipping, collect_feedback, human_handoff.
tonefriendly, professional, casual, formal or enthusiastic.
base_languageRequired. The agent's base language as a BCP-47 code, max 10 characters. Codes are normalised, so pt_br becomes pt-BR.
language_modeauto (default) = the agent answers in the contact's language. fixed = the agent always answers in base_language.
languagesDeprecated. Older clients may still send a list of 1-5 codes. If base_language is missing, languages[0] becomes the base language with mode auto. If you send both, base_language wins.
channel_ids0-20 channels the agent is meant for. An unknown channel returns 422 invalid_channel.
notesOptional, max 2,000. Facts and rules the agent must follow.
ui_languageOptional, max 16. The language of the draft's skills, warnings and research notes. Defaults to base_language.
request_idOptional, 8-64 characters A-Z a-z 0-9 _ . : -. Sending the same request_id again returns the existing job instead of starting a new build; a replay does not count against the build limits and is never charged again.

Unknown fields are rejected (422). A request with neither base_language nor a non-empty languages also returns 422.

The response is 202 Accepted with the job (see below).

Build limits​

LimitValue
Builds per workspace5 per hour, 20 per day
Builds running at the same time1 per workspace (409 build_in_progress)

Poll the job​

GET /agent-builder/jobs/{job_id}

{
"job_id": "…",
"status": "running",
"stage": "drafting",
"result": null,
"error": null,
"request_id": "build-2026-10-05-001",
"created_at": "2026-10-05T09:00:00Z",
"updated_at": "2026-10-05T09:00:20Z"
}
FieldNotes
statusqueued, running, succeeded or failed
stageWhile running: researching, drafting or checking
resultWhen succeeded: the draft with build_id, agent, skills, knowledge_sources, research, warnings and credits_charged. result.agent includes base_language and language_mode.
errorWhen failed: {code, message} with code invalid_request, ai_unavailable, ai_error or interrupted. Nothing is charged.

A build typically takes 40-60 seconds. Poll every few seconds until status is succeeded or failed. An unknown job returns 404 job_not_found.

Create the agent​

Send the draft back, edited as you like, to POST /agent-builder/create:

{
"build_id": "…",
"agent": {
"name": "Example Shoes Assistant",
"persona": "…",
"instructions": "…",
"base_language": "en",
"language_mode": "auto",
"tools_config": {"search_knowledge": true, "handoff": true, "set_state": true},
"handoff_config": {"keywords": ["human", "agent"]},
"escalation_enabled": true
},
"skills": [
{"key": "returns", "title": "Returns", "description": "Use when the customer wants to return an item.", "mode": "model_selected", "body": "…"}
],
"knowledge_sources": [{"source_type": "kb_all"}],
"channel_ids": ["CHANNEL_ID"]
}
FieldNotes
build_idRequired. From the job result.
agentname (required), persona (max 15,000), instructions, model_tier, base_language, language_mode, tools_config, handoff_config, escalation_enabled. Same rules as creating an agent. Drafts from older builds may carry default_language / supported_languages instead; these are still accepted, and the first language becomes base_language with mode auto.
skillsRequired. 1-7 skills. key matches the draft skill; slug optional; title, description, body required; mode is the link mode. Remove skills you don't want.
knowledge_sourcesUp to 20: {source_type: kb_folder | kb_all | web_search | faq, kb_folder_id?, allowed_domains?, is_enabled?}.
channel_idsChannels to activate the agent on once you switch it on.

The language choice is stored on the agent's language_settings:

language_modelanguage_detection_strategyresponse_language
autocascadenull (answer in the contact's language)
fixedfixedthe base_language

The response is 201 with the agent, exactly as GET /agents/{agent_id} returns it. The agent is created inactive: test it in the test console, then activate it with PATCH /agents/{agent_id} {"is_active": true}.

Creating is idempotent per build_id: repeating the call returns the same agent. Builds expire after a while; an expired build_id returns 404 build_not_found, so create the agent soon after the build succeeds.

Errors​

All errors use {"detail": {"code": "…", "error": "…", "message": "…"}}; error repeats code.

StatuscodeWhen
403feature_disabledThe plan does not include Conversational Agents or AI features
403ai_disabledAI features are turned off for the workspace
404job_not_foundUnknown job_id
404build_not_foundUnknown build_id
409build_in_progressAnother build is running
409build_not_readyThe build has not succeeded yet
409create_in_progressThe same build is being created right now
422build_failedThe build failed; start a new one
422invalid_channelA channel id is unknown
422invalid_requestThe draft is invalid (for example a skill or knowledge source)
429rate_limit_exceededBuild limit reached. The body has retry_after (seconds) and the Retry-After header is set.
503ai_unavailableThe AI service or the job queue is temporarily unavailable. Retry after 30 seconds (Retry-After: 30).

Complete example​

API=https://api.sendseven.com/api/v1/automation
AUTH="Authorization: Bearer $SENDSEVEN_API_TOKEN"

# 1. Start the build
JOB=$(curl -s -X POST "$API/agent-builder/generate" -H "$AUTH" -H "Content-Type: application/json" \
-d '{"company_name":"Example Shoes","goals":["answer_questions","human_handoff"],"base_language":"en","request_id":"example-build-0001"}' \
| jq -r .job_id)

# 2. Wait for it
while true; do
STATUS=$(curl -s "$API/agent-builder/jobs/$JOB" -H "$AUTH" | tee job.json | jq -r .status)
[ "$STATUS" = "succeeded" ] || [ "$STATUS" = "failed" ] && break
sleep 3
done

# 3. Create the agent from the unedited draft
jq '{build_id: .result.build_id, agent: .result.agent, skills: .result.skills, knowledge_sources: .result.knowledge_sources}' job.json \
| curl -s -X POST "$API/agent-builder/create" -H "$AUTH" -H "Content-Type: application/json" -d @-