#Consider I have a dynamic variable used in the prompt, how does the agent behave if one of my tool

1 messages · Page 1 of 1 (latest)

old gyroBOT
#
AI-generated Answer for dinesh_85560

Short answer: it won’t change the prompt mid-conversation.

Details:

  • Dynamic variables can be updated by tools (via assignments that map JSON fields to variables), but variables referenced in the agent’s system prompt are set when the conversation starts and do not re-render after a tool updates them. Updated values will be available to subsequent tool calls/headers, not retroactively in the prompt. (elevenlabs.io)
  • ElevenLabs explicitly notes this behavior for system dynamic variables: “In system prompts: Set once at conversation start (value remains static). In tool calls: Updated at execution time (value reflects current state).” (elevenlabs.io)
  • If you need to change the prompt itself, use conversation-time overrides when starting the session (not during it). (elevenlabs.io)

Sources:
Dynamic variables | ElevenLabs Documentation
Dynamic variables | ElevenLabs Documentation
Overrides | ElevenLabs Documentation

wary bobcat
#

I have a list of items that may change based on customer input and tool calls, depending what customer says the tool call will be executed and new items in the list should be considered. How should I provide the list of item information to the agent?

old gyroBOT
#
AI-generated Answer for dinesh_85560

Short answer: use a tool to fetch the list at runtime, not a dynamic variable.

What to do

  • Expose your list via a server tool (webhook) or a client tool that returns the current items as JSON. The agent will call the tool as needed; the tool’s response is then available in the conversation context. For client tools, enable “Wait for response” so the returned JSON is appended to context. (elevenlabs.io)
  • If you need specific scalar fields from the tool response to persist, map them with Dynamic variable assignment in the tool configuration. Dynamic variables updated this way can be reused in later calls and prompts. (elevenlabs.io)
  • Do not try to store the entire list in dynamic variables. Dynamic variables only support string, number, and boolean types. Use tools (or a knowledge base for mostly static catalogs) for lists/objects. (elevenlabs.io)
  • If the list should be available immediately, instruct the agent in its system prompt to call your “get_items” tool before answering, and describe when to refresh it after user actions. (elevenlabs.io)
  • For catalogs that change infrequently and are shared across sessions, add them to the Knowledge Base (files/URLs/text) and update programmatically when needed. Use tools when per-user or per-turn freshness is required. (elevenlabs.io)

Key references

  • Server tools (webhooks), dynamic variable assignment, and orchestration guidance. (elevenlabs.io)
  • Client tools and “Wait for response” appending returned data to conversation context. (elevenlabs.io)
  • Dynamic variables (supported types and updates from tools). (elevenlabs.io)
  • Knowledge Base usage for product catalogs/long‑lived documents. (elevenlabs.io)
  • Prompting guide for specifying when tools should be called. (elevenlabs.io)

Sources:
Server tools | ElevenLabs Documentation
Server tools | ElevenLabs Documentation
Dynamic variables | ElevenLabs Documentation
Conversational AI voice agent prompting guide | ElevenLabs Documentation
Knowledge base | ElevenLabs Documentation
Server tools | ElevenLabs Documentation
Client tools | ElevenLabs Documentation
Dynamic variables | ElevenLabs Documentation
Knowledge base | ElevenLabs Documentation
Conversational AI voice agent prompting guide | ElevenLabs Documentation

wary bobcat
#

Let's say my tool1 responded a dict. Can i access the value of on of its keys when resolving another tool call like tool2?

old gyroBOT
#
AI-generated Answer for dinesh_85560

Yes. Use dynamic variable assignment:

  • Configure tool1 to assign fields from its JSON response to dynamic variables using dot notation (e.g., response.users.0.email). If the path doesn’t exist, nothing is updated. (elevenlabs.io)
  • In tool2, reference those variables in parameters/headers with {{variable_name}}. Dynamic variables can be injected into tool parameters. (elevenlabs.io)
  • If tool1 is a client tool, enable “Wait for response” so the return value is appended to the conversation and can be assigned to dynamic variables. Note: system tools cannot update dynamic variables. (elevenlabs.io)
  • Server tools expose “Dynamic variable assignment” in their configuration; use it to persist values from tool1 for later calls. (elevenlabs.io)

These assignments let tool2 reliably access specific keys from tool1’s dict via the mapped dynamic variables. (elevenlabs.io)

Sources:
Dynamic variables | ElevenLabs Documentation
Dynamic variables | ElevenLabs Documentation
Client tools | ElevenLabs Documentation
Server tools | ElevenLabs Documentation
Dynamic variables | ElevenLabs Documentation

wary bobcat
#

How to refer to values returned by tools in the prompt?

old gyroBOT
#
AI-generated Answer for dinesh_85560

Short answer: use Dynamic Variables and Tool Assignments.

  • Map a field from your tool’s JSON response into a dynamic variable via the tool’s assignments array (source, dynamic_variable, value_path). Example: set dynamic_variable "customer_email" with value_path "response.users.0.email". After the tool runs, that variable is available to the agent.

  • Reference that variable in the agent’s prompt using double curly braces: {{customer_email}}. Dynamic variables can be inserted into system prompts, first messages, and tool parameters/headers.

Important note:

  • System dynamic variables in prompts are evaluated once at conversation start (they won’t retroactively change the already-sent system prompt). Tool-updated variables are available for subsequent tool calls and templated fields.

That’s all you need: assign from tool output → reference with {{variable_name}} in the prompt.

wary bobcat
#

The problem with using dynamic variable is that the information being in the prompt, it will not be available in the current run. Can't I ask the model to check the value of the key 'transaction' in the tool call?

old gyroBOT
#
AI-generated Answer for dinesh_85560

Short answer: not directly in the same LLM run. System-prompt dynamic variables are fixed at conversation start, so the model can’t “peek” into a tool’s raw JSON during that turn. However, you can expose specific fields from a tool response to the model by mapping them into dynamic variables via tool assignments; those variables are updated at tool execution time and can be used in subsequent tool calls and messages.

What to do:

  • In your server tool config, add an assignment that extracts the field and writes it to a dynamic variable:
    • source: "response"
    • value_path: the JSON path (e.g., response.transaction)
    • dynamic_variable: a name you’ll reference later (e.g., transaction)
      After the tool runs, you can use {{ transaction }} in later tool parameters or messages. In prompts, remember these values won’t retroactively change the system prompt for the already-started conversation. (elevenlabs.io)

Where this is documented:

  • Dynamic variables behavior, including “In system prompts: set once at conversation start” and “In tool calls: updated at execution time,” plus “Updating dynamic variables from tools” with dot-path extraction. (elevenlabs.io)
  • The assignments field on tools (source/ value_path/ dynamic_variable) in the Tools API (create/update). (elevenlabs.io)
  • Server tools overview indicating dynamic variable assignment in tool configuration. (elevenlabs.io)

If the key is literally transaction at the top level of your tool’s response, set value_path to response.transaction (or transaction if that’s the root), assign it to dynamic_variable transaction, then reference {{ transaction }} in the next tool call. (elevenlabs.io)

Sources:
Dynamic variables | ElevenLabs Documentation
Dynamic variables | ElevenLabs Documentation
Create tool | ElevenLabs Documentation
Server tools | ElevenLabs Documentation
Dynamic variables | ElevenLabs Documentation

wary bobcat
#

How can I add and update context for the LLM run then? Let says in the first llm run I have a list of transactions, and in the second with more information provided by the customer, I have a new list of transactions. I want only the latest list to be considered by the run