composition_by_language. Read it with GET /v2/agent/{agent_id}, edit it, and send it back with PUT /v2/agent/{agent_id}.
What is composition_by_language
composition_by_language is an object keyed by language code. Each value is an ordered list of nodes. Bolna joins the nodes in order to build the system prompt the agent runs on.
{customer_name} is then filled from the call’s variables, exactly like a variable in a plain-text prompt. See Dynamic variables.
Node types
Every node has atype. No other keys than the ones listed below are accepted.
variable
name: the variable name. Dotted and indexed paths are allowed, for exampleprior.loans.0.amount.scope: one ofexecution,systemoragent_context. Useexecutionfor variables you pass when starting a call (user_dataor batch CSV columns) andsystemfor built-in variables such ascurrent_dateortimezone.
function_tool
name: the name of a tool configured on the agent, such astransfer_call. Letters, digits and underscores only, and it can’t start with a digit.
language_value
name: a slot name, by convention prefixed withlanguage_(for examplelanguage_greeting). Letters, digits and underscores only.values: the wording for each language, keyed by language code:{ "en": "...", "hi": "..." }. A value can also be a list of phrasings, such as["okay", "alright"].
The two shapes
How the object is keyed depends on how the agent’s prompt is built.- Single prompt (one key)
- One prompt per language
Agents using the Single Prompt view have one key, the agent’s default language. The rules and flow are shared On a Hindi call the greeting renders as the
text nodes; every line that is spoken differently per language is a language_value node carrying all its translations.hi value, on an English call as the en value. A language missing from values renders as {language_greeting}, so fill in every language the agent speaks.GET instead of switching between the two shapes.
Read the prompt
GET /v2/agent/{agent_id} returns composition_by_language as a top-level field, next to agent_prompts.
Response (trimmed)
- The composition is the published one for the agent version returned, the same prompt live calls use. Unsaved edits in the platform editor aren’t included.
GET /v2/agent/{agent_id}/versions/{agent_version_id}returns the composition of that specific version.composition_by_languageisnullwhen the agent has no rich text prompt. Its prompt is then the plain-textagent_prompts.task_1.system_prompt, which you update as before.
Update the prompt
Send the editedcomposition_by_language as a top-level key in the PUT /v2/agent/{agent_id} body, alongside agent_config and agent_prompts.
1
Get the agent
Call
GET /v2/agent/{agent_id} and keep composition_by_language.2
Edit the nodes
Change
text, add or remove variable and function_tool nodes, or update the wording inside a language_value node’s values. Keep every language key and every node you aren’t changing.3
Send it back with PUT
Include the full
composition_by_language in the PUT body, with the agent’s agent_config and agent_prompts.Rules for the payload
- The whole object is replaced.
composition_by_languageisn’t merged with what’s stored. A language key you leave out is removed from the prompt. agent_promptsstays the plain-text fallback. While a composition is linked, calls use the composition. Keepagent_prompts.task_1.system_promptin step with it (the prompt rendered as plain text) so the fallback matches.- Empty means no rich text prompt. Sending
{}, or only empty node lists, saves no composition; the agent runs onagent_prompts. - Nodes are validated. An unknown
type, a missing field, an extra key or an invalidnamereturns HTTP 400 with amessageand avalidation_errorslist pointing to the node.
PATCH /v2/agent/{agent_id} doesn’t accept composition_by_language. Use PUT to change a rich text prompt. On an agent with a rich text prompt, patching agent_prompts changes only the plain-text fallback, not what calls say.
