Skip to main content
Agents built in the platform’s prompt editor store their prompt as rich text: an ordered list of typed nodes (plain text, variables, tool references and per-language wording) instead of one plain string. The Agent APIs expose it as the composition_by_language field.

Endpoints

PATCH /v2/agent/{agent_id} doesn’t accept composition_by_language.

composition_by_language object

An object keyed by language code. Each value is an ordered list of nodes, which Bolna joins in order to build the system prompt the agent runs on.
At call time this renders to:
{customer_name} is then filled from the call’s variables, the same as a variable in a plain-text prompt. See Dynamic variables.

Node types

Every node has a type, which decides its other fields. A node with any key not listed for its type is rejected.

text

variable

function_tool

language_value

Prompt shapes

How the object is keyed depends on how the agent’s prompt is built. Keep the shape the agent already uses: edit the nodes you get back from GET instead of switching between the two.
Agents using the Single Prompt view have one key, the agent’s default language. The rules and flow are shared text nodes; every line that is spoken differently per language is a language_value node carrying all its translations.
On a Hindi call the greeting renders as the 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.

Read the prompt

GET /v2/agent/{agent_id} returns composition_by_language as a top-level field, next to agent_prompts.
Request
Response (trimmed)
  • It is the published prompt of the agent version returned, the same prompt live calls use. Unsaved edits in the platform editor aren’t included.
  • It is null when the agent has no rich text prompt. The prompt is then the plain-text agent_prompts.task_1.system_prompt, which you update as before.

Update the prompt

Send the edited composition_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.
Request
Returns HTTP 200, like any agent update. The prompt is saved with the new agent version, and the next calls run on it.
Always send composition_by_language on PUT for an agent that has one. Each PUT creates a new agent version, and only the prompt sent in that request is linked to it. A PUT without it leaves the new version with no rich text prompt, so GET returns null and calls fall back to the plain-text agent_prompts.task_1.system_prompt.

Payload rules

Errors

See Single Prompt view for how marked lines and translations work in the editor.