Ciaran
09/28/2026, 11:35 AMAI Evy
09/28/2026, 11:35 AMAI Evy
09/28/2026, 11:35 AMretell_llm_dynamic_variables, which are string key-value pairs injected into the agent's prompt and tool descriptions [(1) ]() [(2) ]() :
javascript
import { RetellClient } from "retell-client-js-sdk";
const client = new RetellClient({ key: "public_key_YOUR_PUBLIC_KEY" }) ;
let call;
function startCall() {
if (call && call.status !== "ended") return;
call = client.createWebCall({
agent_id: "agent_oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
retell_llm_dynamic_variables: { customer_name: "John Doe" },
metadata: { internal_customer_id: "cust_123" },
hooks: {
onStatus: (status) => console.log("Call status:", status) ,
onEnd: () => console.log("Call ended") ,
onError: (error) => console.error("Call error:", error) ,
},
}) ;
}AI Evy
09/28/2026, 11:35 AMAI Evy
09/28/2026, 11:35 AMretell_llm_dynamic_variables for values the agent should reference in the conversation (e.g., why the customer is reaching out) , and metadata for values you only need to look up later . These variables can then be referenced in the agent's prompt or opening message using {{variable_name}} syntax [(2) ]() .
However, based on a Discord discussion in the sources, fully text-based (chat) conversations with agents were, as of that discussion, not something Retell supported — this was raised as a feature request, with no confirmed timeline for multi-channel (text and voice) agent support [(3) ]() . So if by "live chat" you mean a text-chat widget specifically (rather than a web voice call) , the sources don't confirm this is currently available; the createWebCall() method documented is for browser-based voice calls [(1) ]() .
If you meant initiating a web call (voice) with context, the code above applies. If you specifically need text-based chat, I don't have documentation confirming that capability exists.AI Evy
09/28/2026, 11:35 AMCiaran
09/28/2026, 11:36 AMAI Evy
09/28/2026, 11:36 AMAI Evy
09/28/2026, 11:36 AMAI Evy
09/28/2026, 11:36 AMAI Evy
09/28/2026, 11:36 AMretell_llm_dynamic_variables with a reason_for_chat key, and reference it as {{reason_for_chat}} in your agent's prompt or opening message [(1) ]() .
For chats specifically, you pass retell_llm_dynamic_variables when creating a chat :
Web calls and chats: Pass retell_llm_dynamic_variables when creating a web call or chat.AI Evy
09/28/2026, 11:36 AM{{}} won't work :
> You must use the double curly braces are required. You cannot reference variables without them.
If you want the agent to have this context but never say it out loud to the user, you'd write your prompt so it treats {{reason_for_chat}} as internal context, not something to repeat back — this pattern of using an internal-only variable was discussed with a similar "lead_type" variable, where the variable was kept internal and not shared with the user [(3) ]() :
> Note that the lead type is internal, and I don't want the agent to share that information with the user.
Worth noting: in that same discussion, there was an inconsistency where the agent picked up the internal variable correctly when it was also included in the welcome message, but not otherwise, even with prompt instructions referencing it directly. This wasn't clearly resolved in the thread . So it's worth testing that your {{reason_for_chat}} variable is actually being picked up by having it appear somewhere testable (like temporarily in the opening message) before relying on it purely in hidden prompt instructions.