Agents
The thing that talks — a prompt, a voice, a language set, and the regulatory purpose that decides when it may call.
An agent is what your caller actually speaks to. It carries four things that matter and several that are optional:
systemPrompt | What it is trying to do, in your words |
voice | Which model transcribes, which speaks, in which voice, in which languages |
purpose | The regulatory sender classification — this decides when it may call |
status | draft or live |
curl "$TONE_API/v1/agents" -X POST \
-H "Authorization: Bearer $TONE_KEY" \
-H 'content-type: application/json' \
-d '{
"name": "Order confirmation",
"purpose": "transactional",
"systemPrompt": "You call customers to confirm a cash-on-delivery order. Confirm the order, ask which day suits them for delivery, then thank them and end the call. Be brief and polite.",
"voice": {
"ttsModel": "bulbul:v3",
"ttsVoice": "simran",
"sttModel": "saaras:v3",
"languages": ["hi-IN", "en-IN"]
}
}'Write the task, not the manners
The platform already handles the conversational layer: interruptions, matching the caller's language, waiting when they go quiet, ending the call when it is over. A prompt that spends its words on "be polite and let the user finish" is spending them twice.
Write what the call is for, what counts as done, and what the agent must not promise. That is the part only you know.
Purpose is not a label
🔴 purpose decides which calling window applies to every call this agent
makes, and whether consent is required before it dials at all.
| Purpose | When it may call (IST) | Consent required |
|---|---|---|
promotional | 09:00 – 21:00 | Yes |
collections | 08:00 – 19:00 | No |
service | any time | No |
transactional | any time | No |
It defaults to promotional — the strictest — precisely so that getting it
wrong fails safe. There is deliberately no per-call override: a request
field that relaxed the gate would make the whole audit trail worthless, because
a caller could simply opt out of being checked. See
Compliance.
Publishing and going live
These are two separate steps, and an integration needs both.
- Publish —
POST /v1/agents/{id}/publishfreezes what you have saved into an immutable numbered version, and every call placed from then on runs it.PATCHonly edits the draft: until you publish, calls keep running the previous version, prompt, tools and all. Creating an agent publishes version 1 for you.liveVersionIdon the agent says which version calls run. - Go live —
PATCH /v1/agents/{id}with{"status": "live"}. A new agent is adraft, and a draft can be dialled outbound but will not answer inbound calls, and a campaign will not launch on it.statusis a switch, not a version: it is not in version history, and setting it publishes nothing.
So a first deployment is create → PATCH {"status":"live"}, and every change
after that is PATCH → publish. Calls already in progress are never changed by
either. See Agent versioning.
Updating an agent
PATCH /v1/agents/{id} replaces each top-level field you send and leaves the
rest alone. Three of them are replaced whole, not merged:
callSettings— send the complete object. AcallSettingsholding onlymaxCallSecondsresets the opening line, the transfer settings and every other call setting to their defaults. Read the agent, change the field, send the whole object back.tools— the complete list. A tool you leave out is removed.inputVariables,outputVariables,evaluationCriteria— complete lists.
voice is merged field by field, except voice.languages and
voice.ttsOptions, which are replaced whole. Custom spoken lines are translated
into the agent's languages when callSettings is saved, so after adding a
language, send callSettings again (unchanged is fine) to translate them.
A read is not a write body. GET returns the voice fields flat (ttsModel,
languages, …) and the model as llmModel; PATCH takes them nested under
voice and as llmModel, and refuses fields it does not take, such as id or
createdAt.
Variables
inputVariables are {{placeholders}} the prompt can reference and each call
can fill:
{ "inputVariables": [{ "name": "customer_name", "default": "", "required": true }] }curl "$TONE_API/v1/calls" -X POST \
-H "Authorization: Bearer $TONE_KEY" \
-H 'content-type: application/json' \
-d '{"agentId":"...","numberId":"...","toE164":"+919876543210",
"variables":{"customer_name":"Priya"}}'Leave default empty unless it is a real fallback, and mark a variable the
call cannot do without required: a dial that leaves it out is refused with
422 missing_variables instead of reaching a customer. A filler default such as
"there", "unknown" or "our store" is treated as empty — a spoken sentence
that needs it is left out rather than said with the filler in it.
The one exception is a name a greeting is addressed to. Without the name, only the
name is left out: Hello {{first_name}}, I am Asha from Anaya Fashion. is spoken
as "Hello, I am Asha from Anaya Fashion." This covers the greeting words in every
supported language ("नमस्ते", "ನಮಸ್ಕಾರ", "Good morning", "Thank you"…), when the greeting
starts the sentence and the name is followed by punctuation.
Am I speaking with {{first_name}}? is still left out whole.
A placeholder needs two braces on each side. {customer_name} is plain text:
no call fills it, and the agent is not given the value at all. The save still
succeeds, but the agent's warnings says so, on the POST or PATCH response
and on every read until it is fixed:
{
"warnings": [
{
"code": "single_brace_placeholder",
"field": "systemPrompt",
"message": "{customer_name} is written with single braces, so calls do not fill it and the agent is not given its value. Write {{customer_name}}."
}
]
}Check warnings before you publish. It is empty when there is nothing to fix, and
code is an open set, so handle a value you do not recognise.
Structured context
variables are flat, short text values — each one is spoken, mapped from a CSV
column, or both. For anything nested (order lines, timestamps, account traits),
send context with the call instead: any JSON object, objects and arrays
included, up to 8 KB and five levels deep.
curl "$TONE_API/v1/calls" -X POST \
-H "Authorization: Bearer $TONE_KEY" \
-H 'content-type: application/json' \
-d '{"agentId":"...","numberId":"...","toE164":"+919876543210",
"variables":{"customer_name":"Priya"},
"context":{"order":{"id":"AC-4417","total":997,
"items":[{"name":"Silicone case","qty":2},{"name":"Screen guard","qty":1}]},
"customer":{"tier":"repeat","orders":3}}}'- Nothing to declare. The agent sees all of it on the call, listed as facts from your system. Its prompt can say "confirm each item in the order" without naming a field.
- Read one value by path with
{{context.order.total}}or{{context.order.items.0.name}}— in the prompt, the opening line or a pinned tool parameter. A path to an object or a list reads the whole thing; a path that is missing ornullis treated like an empty variable: a spoken sentence that needs it is left out rather than read with a hole. - It is data, not instructions. Values are listed so that nothing in them can start a new section of the prompt, and the agent is told they never change its instructions. Rules like "offer free shipping to repeat customers" belong in the prompt, referring to the value.
- It costs tokens on every turn, since the agent reads it all each time it answers. Send what the conversation needs rather than your whole order record.
- Stored on the call and returned as
contextbyGET /v1/calls/{id}and every call webhook, so you can match the outcome back.
outputVariables run the other way: fields extracted from the transcript after
the call and returned as outputs on the call record. The description is the
extraction instruction — write it as you would tell a person what to look for,
not as a field label.
evaluationCriteria are questions a post-call judge answers about the call,
returned as evaluations with a verdict and a rationale each. Use them for "did
this call do its job", not for data you want back — that is what output
variables are for.
Call settings
callSettings is how the call runs rather than what it says: the opening
line, background ambience, what to do when the caller goes quiet, voicemail
handling, a maximum duration and a farewell. Custom lines are translated into
the agent's languages automatically when you save.
Two of those are stripped on inbound calls, deliberately: an opening line is
written as "calling from X about Y" and would greet someone who rang you, and
voicemail detection is a callee-side judgement that would hang up on a real
person. For calls people place to your number, set inboundOpeningLine (for example
Thank you for calling {{business_name}}, how can I help?); without one, the agent
greets with a built-in "how can I help you?".
Every call opens with a fixed introduction before the opening line, naming the
agent's businessName: "Hi, I'm Anaya Fashion's digital assistant." No prompt can change or skip it. On calls
people make to your number you can drop it with inboundIntroduction: false, when
the agent has an inboundOpeningLine that names your business. On calls your agents
place it stays, unless you ask us to turn it off for your organization. Either way,
the agent still says it is a digital assistant when asked.
Deleting
Deleting an agent unassigns its numbers rather than releasing them, and keeps its call log. Deleting the agent must not erase the record of what it said.