https://retellai.com/?utm_source=discord&utm_medium=seo logo
Persisting variables when performing an agent swap
# ❓・ai-evy-support
c
@AI Evy Persisting variables when performing an agent swap.
a
Thanks for tagging me @Ciaran. I'll look through relevant sources and get back to you shortly.
### Answer I don't have explicit documentation about persisting dynamic variables specifically during agent swaps in the official Retell AI documentation. However, based on community discussions, there have been reports of dynamic variables not persisting when using agent swap functionality [(1) ]() . In one case, variables set at the beginning of a call via webhook (like API tokens) were not accessible in the swapped agent . For multi-state agents, once variables are defined as an edge parameter, they should be available for other states within the same agent [(2) ]() . If you're experiencing issues with variables not persisting during agent swaps, you may want to: 1. Verify that both agents have the dynamic variables configured 2. Ensure variables are being passed correctly in your agent swap implementation 3. Consider using the Update Call API to explicitly set variables during the swap Check out these potentially useful sources: [Dynamic Variables]() Would you like me to try to provide a general approach based on my knowledge of similar systems?
​ To learn more, see the sources I considered: [[1] Dynamic Variables not persisted](https://discord.com/channels/1186424376300679209/1432409107393937589) [[2] Stateful agent variables](https://discord.com/channels/1186424376300679209/1236815489230045245) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy So if I set up a webhook event for transfer has been successful, would we be able to do something where we can pass its dynamic variables back?
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer You can update dynamic variables during an ongoing call using the Update Live Call API [(1) ]() . This endpoint allows you to override dynamic variables on a running call by setting the
override_dynamic_variables
field . The API accepts a PATCH request to
/v2/update-live-call/{call_id}
with a body structure like :
Copy code
json
{
  "fields_to_override": {
    "override_dynamic_variables": {
      "additional_discount": "15%"
    }
  }
}
This override takes effect immediately on the live call . You only need to set the delta where you want to override—no need to set the entire dynamic variables object . For calls that have ended, you can use the Update Call API at
/v2/update-call/{call_id}
, which also supports the
override_dynamic_variables
field [(2) ]() . Setting this to null will remove any existing override . However, I don't have specific documentation about webhook events triggered specifically for "transfer has been successful" or how dynamic variables are handled in that webhook payload. The sources show webhook events like
call_started
,
call_ended
, and
call_analyzed
[(3) ]() , where dynamic variables appear in the
call_analyzed
event . Check out these potentially useful sources: [Update Live Call]() , [Update Call]() Would you like me to try to provide a general approach based on my knowledge?
​ To learn more, see the sources I considered: [[1] Update Live Call](https://docs.retellai.com/api-references/update-live-call) [[2] Update Call](https://docs.retellai.com/api-references/update-call) [[3] Passing dynamic variables to webhook](https://discord.com/channels/1186424376300679209/1351235749537910795) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy Riddle me this... Call inbound, agent transfers to agent, could we get a webhook for when that's successful?
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer Yes, Retell AI supports webhook events for agent-to-agent transfers [(1) ]() . When an agent transfers to another agent, you can receive the following transfer-related webhook events : -
transfer_started
- Triggered when a transfer is initiated -
transfer_bridged
- Triggered when a transfer successfully bridges -
transfer_cancelled
- Triggered when a transfer is cancelled or fails to connect -
transfer_ended
- Triggered when the transfer leg ends The
transfer_bridged
event is specifically what you're looking for to confirm a successful transfer . Each of these webhook events includes full call data plus
transfer_destination
and
transfer_option
(if available) . You can configure which events are delivered per agent using the
webhook_events
field when creating or updating an agent . By default, voice agents receive
call_started
,
call_ended
, and
call_analyzed
events, so you'll need to explicitly add the transfer events if you want to receive them .
​ To learn more, see the sources I considered: [[1] Webhook Overview](https://docs.retellai.com/features/webhook-overview) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy Calling the agent, set up my webhook settings to be my computer. I'm not receiving a transfer_bridged webook? Im just getting teh call_started one?
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer When you only receive
call_started
but not
transfer_bridged
, the issue is likely that you haven't explicitly configured your agent to send transfer-related webhook events [(1) ]() [(2) ]() . By default, voice agents only receive
call_started
,
call_ended
, and
call_analyzed
webhook events [(2) ]() . To receive transfer events like
transfer_bridged
, you must explicitly add them to the
webhook_events
field when creating or updating your agent [(1) ]() [(2) ]() . When creating an agent, include the transfer events in your configuration [(1) ]() :
Copy code
json
{
  "webhook_url": "<https://your-computer-url%22,>
  "webhook_events": [
    "call_started",
    "call_ended",
    "call_analyzed",
    "transfer_started",
    "transfer_bridged",
    "transfer_cancelled",
    "transfer_ended"
  ]
}
The
webhook_events
field accepts these transfer-related options [(2) ]() : -
transfer_started
-
transfer_bridged
-
transfer_cancelled
-
transfer_ended
Update your agent configuration to include
transfer_bridged
in the
webhook_events
array, and you should start receiving those webhook notifications when transfers successfully bridge [(1) ]() [(2) ]() . Additionally, be aware that after an agent transfer, the webhook from the original agent continues to fire—the second agent's webhook doesn't automatically activate post-transfer [(3) ]() . If you need webhooks from both agents during a transfer scenario, consider using a shared webhook URL at the account level or from Agent 1 to capture all events .
​ To learn more, see the sources I considered: [[1] Create Voice Agent](https://docs.retellai.com/api-references/create-agent) [[2] Webhook Overview](https://docs.retellai.com/features/webhook-overview) [[3] Agent Transfer - WebHook Not Firing In Agent2](https://discord.com/channels/1186424376300679209/1405501501337763861) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy Do I do this on the transferred agent or the agent transferring?
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer Based on the available sources, you should configure the
webhook_events
field on the original agent (the one initiating the transfer) [(1) ]() [(2) ]() . After an agent transfer, the webhook from the original agent continues to fire—the second agent's webhook doesn't automatically activate post-transfer [(3) ]() . This means transfer events like
transfer_bridged
will be sent to the webhook URL configured on the first agent . To receive transfer events, update your original agent with the
webhook_events
configuration [(1) ]() [(2) ]() :
Copy code
json
{
  "webhook_url": "<https://your-computer-url%22,>
  "webhook_events": [
    "call_started",
    "call_ended",
    "call_analyzed",
    "transfer_started",
    "transfer_bridged",
    "transfer_cancelled",
    "transfer_ended"
  ]
}
[(1) ]() , [(2) ]() If you need webhooks from both agents during a transfer scenario, consider using a shared webhook URL at the account level to capture events from all agents [(3) ]() .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
​ To learn more, see the sources I considered: [[1] Create Voice Agent](https://docs.retellai.com/api-references/create-agent) [[2] Update Voice Agent](https://docs.retellai.com/api-references/update-agent) [[3] Agent Transfer - WebHook Not Firing In Agent2](https://discord.com/channels/1186424376300679209/1405501501337763861) ​
c
@AI Evy So I checked ALLL of the transfer_* webhooks and not one hit me... Is it using the inbound webhook or the webhook settings?
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer When you configure webhook events for an agent, those settings apply to that specific agent's webhook URL [(1) ]() [(2) ]() . The
webhook_events
field determines which events are delivered to the
webhook_url
you've set on the agent [(1) ]() [(3) ]() . For inbound calls, the webhook configuration comes from the agent associated with that phone number or call [(1) ]() [(2) ]() . If you've set agent-level webhooks using the
webhook_url
field, those will be used instead of account-level webhooks [(1) ]() [(3) ]() [(2) ]() . However, there's an important behavior to note: after an agent transfer, the webhook from the original agent continues to fire—the second agent's webhook doesn't automatically activate post-transfer [(4) ]() . This means all transfer events (
transfer_started
,
transfer_bridged
,
transfer_cancelled
,
transfer_ended
) should be sent to the original agent's webhook URL . To troubleshoot why you're not receiving transfer webhooks: 1. Verify the webhook URL is correct on your original/first agent (the one handling the inbound call initially) [(1) ]() [(2) ]() 2. Confirm
webhook_events
includes the transfer events
on that same agent [(1) ]() [
(3) ]() 3. Check your webhook endpoint is accessible and returning 2xx status codes within 10 seconds [(3) ]() 4. Verify the transfer is actually occurring - if the call doesn't connect or the transfer fails before bridging, certain events won't fire If you want to receive events from all agents regardless of transfers, consider setting up an account-level webhook through the dashboard's webhooks tab instead of agent-level webhooks [(3) ]() [(4) ]() .
​ To learn more, see the sources I considered: [[1] Create Voice Agent](https://docs.retellai.com/api-references/create-agent) [[2] Get Voice Agent](https://docs.retellai.com/api-references/get-agent) [[3] Webhook Overview](https://docs.retellai.com/features/webhook-overview) [[4] Agent Transfer - WebHook Not Firing In Agent2](https://discord.com/channels/1186424376300679209/1405501501337763861) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy So how is the transfer_bridged event triggered? If i'm calling and then transfer the agent successfully, it should trigger the webhook correct?
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer Yes, the
transfer_bridged
event should trigger when a transfer successfully bridges [(1) ]() . According to the documentation,
transfer_bridged
is "Triggered when a transfer successfully bridges" . For the webhook to fire correctly, you need to ensure: 1. The
webhook_events
array includes
transfer_bridged
on the original agent (the one initiating the transfer) [(1) ]() [(2) ]() [(3) ]() . The default events are only
call_started
,
call_ended
, and
call_analyzed
, so transfer events must be explicitly added [(1) ]() . 2. Your webhook endpoint must respond with a 2xx status code . Retell expects a successful status code with no body required . 3. The webhook timeout is set appropriately - the default is 10,000ms (10 seconds) [(1) ]() [(2) ]() [(3) ]() . If your endpoint doesn't respond within this timeframe, the webhook may fail. 4. The transfer must actually complete the bridge. If the transfer is cancelled or fails to connect before bridging, you'll receive
transfer_cancelled
instead of
transfer_bridged
[(1) ]() . The
transfer_bridged
event payload includes full call data plus
transfer_destination
and
transfer_option
(if available) . If you've confirmed all these settings are correct and still aren't receiving the webhook, double-check that: - Your webhook URL is accessible from Retell's servers - The transfer is completing successfully (not being canc
elled or failing) - You're monitoring the correct endpoint that matches the
webhook_url
configured on your agent [(2) ]() [(4) ]() [(3) ]()
​ To learn more, see the sources I considered: [[1] Webhook Overview](https://docs.retellai.com/features/webhook-overview) [[2] Create Voice Agent](https://docs.retellai.com/api-references/create-agent) [[3] Update Voice Agent](https://docs.retellai.com/api-references/update-agent) [[4] Get Voice Agent](https://docs.retellai.com/api-references/get-agent) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy So I gave it a call and I got the call_inbound, it transfered, no webhook, ended called, call_analyzed. I have call_inbound, call_analyzed and all the transfer_ webhooks checked.
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer Based on your description, there are a few things to verify: First, confirm the exact event names. The valid webhook event options for voice agents are [(1) ]() [(2) ]() [(3) ]() : -
call_started
(not
call_inbound
) -
call_ended
-
call_analyzed
-
transcript_updated
-
transfer_started
-
transfer_bridged
-
transfer_cancelled
-
transfer_ended
You mentioned checking
call_inbound
, but the correct event name is
call_started
. If you've configured
call_inbound
in your
webhook_events
array, that could be why you're not receiving the expected webhooks. Second, verify your agent configuration. Check your agent's
webhook_events
field to ensure it includes the transfer events [(2) ]() [(3) ]() :
Copy code
json
{
  "webhook_events": [
    "call_started",
    "call_ended",
    "call_analyzed",
    "transfer_started",
    "transfer_bridged",
    "transfer_cancelled",
    "transfer_ended"
  ]
}
[(2) ]() Third, confirm the transfer type. The
transfer_bridged
event is triggered when a transfer successfully bridges [(1) ]() . If you're doing an agent-to-agent transfer (agent swap) rather than a phone number transfer, the behavior may differ. After an agent transfer, the webhook from the original agent continues to fire—the second agent's webhook doesn't automatically activate post-transfer [(4) ]() . Fourth, check webhook ordering. Webhooks are triggered in order but are not blocking [(1) ]() . When a call did not connect (like calls with
dial_failed
,
dial_no_answer
,
dial_busy
disconnection reason) , it will not have its
call_started
webhook triggered, but will still have its
call_ended
and
call_analyzed
webhooks triggered . Update your agent configuration with the correct event names and verify that your webhook endpoint is responding with a 2xx status code within the timeout period (default 10,000ms) [(1) ]() [(2) ]() [(3) ]() .
​ To learn more, see the sources I considered: [[1] Webhook Overview](https://docs.retellai.com/features/webhook-overview) [[2] Create Voice Agent](https://docs.retellai.com/api-references/create-agent) [[3] Create Agent Version](https://docs.retellai.com/api-references/create-agent-version) [[4] Agent Transfer - WebHook Not Firing In Agent2](https://discord.com/channels/1186424376300679209/1405501501337763861) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy The agent that transfers to another agent's webhooks Call started Call analyzed Transfer started Transfer bridged Transfer cancelled Transfer ended The agent swap node is Post Call Analysis Setting Select which agent's analysis fields to include in the call history. Both this agent and transferred agent Webhook Setting Select which agent's webhook endpoint to use for sending call updates. Only transferred agent
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer Based on your configuration, the issue is likely in your Agent Swap Node's Webhook Setting. You've set it to "Only transferred agent," which means transfer events won't be sent to your original agent's webhook endpoint. When you configure the Agent Swap Node with "Only transferred agent" for the webhook setting, the system switches to using the transferred agent's webhook configuration. However, as mentioned in community discussions, after an agent transfer, the webhook from the original agent typically continues to fire—the second agent's webhook doesn't automatically activate post-transfer. To receive transfer webhooks, you should: 1. Change the Agent Swap Node's Webhook Setting to use the original agent's webhook (not "Only transferred agent") 2. Ensure your original agent has all transfer events configured in its
webhook_events
array [(1) ]() :
Copy code
json
{
  "webhook_events": [
    "call_started",
    "call_ended",
    "call_analyzed",
    "transfer_started",
    "transfer_bridged",
    "transfer_cancelled",
    "transfer_ended"
  ]
}
The transfer events (
transfer_started
,
transfer_bridged
,
transfer_cancelled
,
transfer_ended
) need to be sent to a webhook endpoint that's actively listening, and by selecting "Only transferred agent," you're routing those events away from your configured endpoint. Try switching the Webhook Setting in your Agent Swap Node to use the original agent's webhook, and you should start receiving the transfer event webhooks.
​ To learn more, see the sources I considered: [[1] Create Voice Agent](https://docs.retellai.com/api-references/create-agent) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy So use the 'Only this agent' on the webhook settings?
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer Yes, based on your configuration, you should use "Only this agent" for the webhook setting in your Agent Swap Node if you want to receive the transfer webhooks (
transfer_started
,
transfer_bridged
,
transfer_cancelled
,
transfer_ended
) [(1) ]() . The key behavior to understand is that after an agent transfer, the webhook from the original agent continues to fire—the second agent's webhook doesn't automatically activate post-transfer . This means transfer events will be sent to whichever agent's webhook you configure in the Agent Swap Node. Since you have all the transfer events configured in your original agent's
webhook_events
array [(2) ]() [(3) ]() [(4) ]() : -
call_started
-
call_ended
-
call_analyzed
-
transfer_started
-
transfer_bridged
-
transfer_cancelled
-
transfer_ended
Setting the Agent Swap Node to "Only this agent" will ensure those transfer webhooks are sent to your original agent's webhook endpoint, which is the one you've been monitoring.
​ To learn more, see the sources I considered: [[1] Agent Transfer - WebHook Not Firing In Agent2](https://discord.com/channels/1186424376300679209/1405501501337763861) [[2] List Voice Agents](https://docs.retellai.com/api-references/list-agents) [[3] Create Agent Version](https://docs.retellai.com/api-references/create-agent-version) [[4] Get Voice Agent](https://docs.retellai.com/api-references/get-agent) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy Done that... Set all the webhook events. I can see they're checked. Set up agent transfer to be Only this agent for Webhook settings and dstill not getting anything. I feel like i'm missing something stupid here. I called it, call_inbound webhook, call_started webhook, transferred (no webhook), ended call, call_analyzed webhook
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer Based on your description, I notice you mentioned receiving a "call_inbound webhook" - but the valid webhook event name is
call_started
, not
call_inbound
[(1) ]() [(2) ]() [(3) ]() [(4) ]() . The valid webhook events for voice agents are [(1) ]() [(3) ]() [(4) ]() : -
call_started
-
call_ended
-
call_analyzed
-
transcript_updated
-
transfer_started
-
transfer_bridged
-
transfer_cancelled
-
transfer_ended
If you've somehow configured
call_inbound
in your webhook events, that's not a recognized event type and could indicate a configuration issue. To troubleshoot: 1. Use the Get Voice Agent API to verify your exact
webhook_events
configuration [(4) ]() 2. Confirm your
webhook_url
is correctly set and accessible [(1) ]() [(4) ]() 3. Ensure your webhook endpoint responds with a 2xx status code within the timeout period (default 10,000ms) [(1) ]() [(3) ]() [(4) ]() 4. Verify the transfer is actually completing - if it fails before bridging, you'll get
transfer_cancelled
instead of
transfer_bridged
The Agent Transfer Node documentation mentions that transfer settings behavior means certain settings from the first agent pers
ist throughout the call [(5) ]() . Double-check that your original agent's webhook configuration is properly set with all transfer events explicitly included in the
webhook_events
array [(1) ]() [(3) ]() [(4) ]() .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy {"event"=>"call_inbound", "event_timestamp"=>1781195025044, "call_inbound"=>{"agent_id"=>"agent_d7182 {"event"=>"call_started", "call"=>{"call_id"=>"call_43f63ceb69106ba {"event"=>"call_analyzed", "call"=>{"call_id"=>"call_43f63ceb69106ba954
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer I see you're receiving
call_inbound
,
call_started
, and
call_analyzed
webhooks, but no transfer events. Based on your webhook logs, you're getting the expected basic call events, which confirms your webhook endpoint is working correctly. **The key issue**: You're using an Agent Transfer (agent swap) , not a traditional phone transfer [(1) ]() . Agent Transfer has different webhook behavior than phone-based transfers. According to the documentation, the valid webhook events for voice agents are [(2) ]() [(3) ]() [(4) ]() [(5) ]() : -
call_started
-
call_ended
-
call_analyzed
-
transcript_updated
-
transfer_started
-
transfer_bridged
-
transfer_cancelled
-
transfer_ended
However, these transfer webhook events (
transfer_started
,
transfer_bridged
, etc.) are documented in the context of phone-based call transfers, not Agent Transfer (agent swap) [(2) ]() . The Agent Transfer Node documentation states that when you use agent swap, "the following settings of the first agent will be used throughout the call: optInSignedUrl, optOutSensitiveDataStorage, webHookUrl" [(1) ]() . This means your original agent's webhook continues to be used. **The critical distinction**: The
transfer_bridged
event is "Triggered when a transfer successfully bridges" [(2) ]() , which refers to bridging a phone call to another phone number or extension. When you perform an Agent Transfer (swappin
g from one AI agent to another AI agent) , you're not creating a phone bridge—you're switching the conversation handler within the same call session [(1) ]() . This explains why you're not seeing
transfer_bridged
or other transfer webhooks—those events are designed for phone-based transfers, not agent-to-agent swaps [(2) ]() [(1) ]() . To track agent swaps, you'll need to use alternative approaches since the transfer webhooks don't apply to Agent Transfer nodes [(1) ]() [(6) ]() .
​ To learn more, see the sources I considered: [[1] Agent Transfer Node](https://docs.retellai.com/build/conversation-flow/transfer-agent-node) [[2] Webhook Overview](https://docs.retellai.com/features/webhook-overview) [[3] List Voice Agents](https://docs.retellai.com/api-references/list-agents) [[4] Update Voice Agent](https://docs.retellai.com/api-references/update-agent) [[5] Get Agent Versions](https://docs.retellai.com/api-references/get-agent-versions) [[6] Agent Transfer - WebHook Not Firing In Agent2](https://discord.com/channels/1186424376300679209/1405501501337763861) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy The whole reason for this is because somebody called out number and it transferred to another agent and it didn't persist the variables.... So what can. do?
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer When you perform an Agent Transfer (agent swap) , the destination agent has access to the full conversation history, which should include context from the original agent [(1) ]() . However, if you need to explicitly pass dynamic variables between agents, here's what you can do: Option 1: Use the Agent Transfer Node's Post Call Analysis Setting Configure your Agent Transfer Node to include "Both this agent and transferred agent" for the Post Call Analysis Setting . This ensures both agents' data is captured. Option 2: Pass Variables Through the Call When the transferred agent starts, it inherits the full conversation history from the original agent . The dynamic variables set during the original agent's session should be available throughout the call. According to the transfer settings behavior documentation: "The following settings of the first agent will be used throughout the call: optInSignedUrl, optOutSensitiveDataStorage, webHookUrl" . This means the webhook configuration persists, but other settings like dynamic variables should be accessible to the transferred agent through the conversation context. Option 3: Use Webhooks to Track and Re-inject Variables Since you're receiving
call_started
and
call_analyzed
webhooks [(2) ]() , you could: 1. Capture the dynamic variables in the
call_started
or custom webhook events [(2) ]() [(3) ]() 2. Store them in your system 3. Re-inject them if needed using the conversation context The key limitation is that Agent Transfer is designed to maintain conversation continuity [(1) ]() , s
o variables should persist through the conversation history rather than requiring explicit passing mechanisms. If variables aren't persisting as expected, verify that: - Your dynamic variables are properly set in the original agent [(4) ]() - The transferred agent's prompts reference the same variable names using
{{variable_name}}
syntax - You're using the Agent Transfer Node (not Call Transfer Node) to maintain the same call session [(1) ]()
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
​ To learn more, see the sources I considered: [[1] Agent Transfer Node](https://docs.retellai.com/build/conversation-flow/transfer-agent-node) [[2] Webhook Overview](https://docs.retellai.com/features/webhook-overview) [[3] Passing dynamic variables to webhook](https://discord.com/channels/1186424376300679209/1351235749537910795) [[4] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) ​
c
@AI Evy Option 1: This is done post call? Not during the transfer. I want to pass the variables across to the other agent. Option 2: The issue is that no conversation has started. Its a checked to see if inbound then you go to our inbond agent via an agent transfer. Option 3: I call the outbound number, its for the agent 1 and call_started comes and its for agent 1 but agent 1 instantly transfers to agent 2, no webhook for that one.
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer Based on your scenario, here's what's happening: **The Core Issue**: When Agent 1 instantly transfers to Agent 2 at the start of a call (before any conversation) , you're facing two problems: 1. No transfer webhooks are firing (because Agent Transfer doesn't trigger
transfer_bridged
events—those are only for phone-based transfers) [(1) ]() [(2) ]() 2. Variables aren't persisting to Agent 2 **Why This Happens**: Agent Transfer maintains the same call session and the destination agent has access to the full conversation history [(2) ]() . However, when you transfer immediately before any conversation occurs, there's no conversation context yet to pass along. **Your Options**: Option A: Set Variables Before Transfer If Agent 1 needs to pass information to Agent 2, have Agent 1 set dynamic variables explicitly before the transfer occurs. The transferred agent should have access to these through the conversation context since "the destination agent has access to the full conversation history" . Option B: Use Account-Level Webhooks Set up an account-level webhook through the dashboard's webhooks tab [(1) ]() . This ensures webhook events fire regardless of which agent is handling the call [(3) ]() . This won't solve the variable persistence issue directly, but gives you visibility into all call events. Option C: Use Custom Function to Pass Data Add a custom function node in Agent 1 that explicitly captures and stores the variables you need before the transfer . This function can trigger your webhook directly with the data you need to per
sist. **The Limitation**: The
webHookUrl
setting from the first agent persists throughout the call [(2) ]() , but Agent Transfer webhooks (
transfer_started
,
transfer_bridged
, etc.) are designed for phone-based call transfers, not agent-to-agent swaps [(1) ]() [(2) ]() . This is why you're not seeing transfer webhooks when using Agent Transfer nodes.
​ To learn more, see the sources I considered: [[1] Webhook Overview](https://docs.retellai.com/features/webhook-overview) [[2] Agent Transfer Node](https://docs.retellai.com/build/conversation-flow/transfer-agent-node) [[3] Agent Transfer - WebHook Not Firing In Agent2](https://discord.com/channels/1186424376300679209/1405501501337763861) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy Could we maybe get a function that just loops over the all the dynamic_variables and set them up?
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer Based on your scenario where you need to persist dynamic variables during an agent transfer, here's a practical solution using a Custom Function before the transfer: Create a Custom Function Node Before Agent Transfer Add a Custom Function node in Agent 1's conversation flow that captures all current dynamic variables and passes them forward. You can use the Extract Dynamic Variable tool to capture conversation data, then immediately transfer [(1) ]() . Example Approach: 1. Before the Agent Transfer Node, add a Subagent Node or Function Node with a Custom Function 2. Configure the Custom Function to call your endpoint that stores the variables 3. Use Response Variables to set dynamic variables that will persist through the transfer [(2) ]() How Dynamic Variables Work: Dynamic variables use the
{{variable_name}}
syntax and can be injected into prompts, begin messages, and tool configurations . When you set dynamic variables at the agent level, they serve as defaults and are used when specific variables aren't included in the call request . Key Limitation: According to the Agent Transfer documentation, when transferring between agents, "the following settings of the first agent will be used throughout the call: optInSignedUrl, optOutSensitiveDataStorage, webHookUrl" [(3) ]() . However, dynamic variables should be accessible to the transferred agent through the conversation context since "the destination agent has access to the full conversation history" . Workaround for Immediate Transfers: Since you're transferring immediately before conversation starts, consider using a Custom Function to explicitly set and store variab
les, then have Agent 2 reference those same variable names using
{{variable_name}}
syntax in its prompts [(2) ]() . This isn't a built-in "loop over all variables" function, but you can build this logic into a Custom Function that captures and forwards the specific variables you need to persist.
​ To learn more, see the sources I considered: [[1] Subagent Node](https://docs.retellai.com/build/conversation-flow/subagent-node) [[2] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[3] Agent Transfer Node](https://docs.retellai.com/build/conversation-flow/transfer-agent-node) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy Just to add, this is for a phone call... I'm just so lost. I don't understand how these webhooks aren't happening. Am I thinking about that the transfer_bridged webhook SHOULD fire if the agent trransferred successfully to another agent?
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer No,
transfer_bridged
webhooks will NOT fire for Agent Transfer (agent swap) .
This is the core misunderstanding. Agent Transfer vs Call Transfer - Critical Difference: - Agent Transfer (agent swap) : Switches between AI agents within the same call session [(1) ]() [(2) ]() - Call Transfer (phone-based) : Transfers the call to another phone number or SIP URI [(3) ]() The
transfer_bridged
,
transfer_started
,
transfer_cancelled
, and
transfer_ended
webhook events are only for phone-based Call Transfers , not Agent Transfers [(1) ]() [(2) ]() . Why No Transfer Webhooks for Agent Transfer: When you use an Agent Transfer node, you're not creating a phone bridge—you're switching the conversation handler within the same call session . The call continues with the same call_id, and the destination agent has access to the full conversation history . What Webhooks You WILL Receive: -
call_started
(when the original call begins) -
call_ended
(when the entire call ends) -
call_analyzed
(after the call completes) This matches exactly what you're seeing in your logs. For Dynamic Variables During Agent Transfer: The documentation states that "the destination agent has access to the full conversation history" . However, since you're transferring immediately before conversation starts, there's no conversation context yet. Your Options: 1. Set dynamic variables in Agent 1 before the transfer occurs using Extract Dynamic Variable tools [(4) ]()
2. Configure agent-level default dynamic variables that both agents can reference 3. Use the Agent Transfer Node's "Post Call Analysis Setting" to include "Both this agent and transferred agent" [(1) ]() [(2) ]() The key takeaway: Agent Transfer does not trigger transfer webhooks. Those are only for phone-based Call Transfer nodes [(3) ]() .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy So if I update it from agent swap to call transfer, it should trigger right?
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer Yes, if you switch from Agent Transfer to Call Transfer (phone-based transfer) , the transfer webhooks SHOULD trigger. *Call Transfer (phone-based) * transfers the call to another phone number or SIP URI, and these transfers do trigger the transfer webhook events [(1) ]() : -
transfer_started
-
transfer_bridged
-
transfer_cancelled
-
transfer_ended
However, this comes with significant trade-offs compared to Agent Transfer: Disadvantages of Call Transfer vs Agent Transfer: - **Higher Latency**: The transition is much slower than agent swap [(2) ]() [(3) ]() - **Lower Reliability**: Creates a new phone call, which can fail - **Requires Handoff Messages**: The destination doesn't automatically get conversation history - **Requires Separate Phone Numbers**: Each agent receiving transfers needs its own phone number But you'll lose the key benefits of Agent Transfer: - Near-instant transition - Full conversation history access for the destination agent - No separate phone numbers needed For your variable persistence issue, Call Transfer won't solve it—you'd need to explicitly pass data through handoff messages or webhooks. The real solution is to set dynamic variables in Agent 1 before the transfer occurs, so they're available in the conversation context when Agent 2 takes over .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy Is there a way to remove that beep on call transfer?
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer Based on the available sources, I don't have specific information about removing or disabling the transfer beep sound during Call Transfer operations in Retell AI. The documentation covers Call Transfer configuration options like caller ID settings, whisper messages, three-way messages, and on-hold music [(1) ]() [(2) ]() , but doesn't explicitly mention controlling or removing the transfer beep. I'd recommend checking out these potentially useful sources: - [Call Transfer Node]() - [Platform Changelogs]() Would you like me to try to provide a general answer based on my knowledge instead?
​ To learn more, see the sources I considered: [[1] Platform Changelogs | Retell AI](https://www.retellai.com/changelog) [[2] CF Components, Warm Transfer Caller ID, Call History & More.](https://www.retellai.com/changelog/cf-components-warm-transfer-caller-id-call-history-more) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy We can't have that beeping and long wait... I've set the wait to a warm transfer to but I do het the webhook. The changing of tones is bad imo. We just have to do it another way... How would you recommend transferring variables from one agent to another...?
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer Given your constraints (no beeping, no long waits) , Agent Transfer is your best option. Here's how to properly pass variables between agents: Recommended Approach: Set Dynamic Variables Before Agent Transfer Dynamic variables can be set at the agent level as defaults, which serve as fallback values when specific variables aren't included in the call request [(1) ]() . Configure these on Agent 1 before the transfer occurs. Implementation Steps: 1. Configure Agent-Level Default Dynamic Variables on Both Agents - Set default values for your variables on Agent 1 - Configure Agent 2 to reference the same variable names using
{{variable_name}}
syntax in prompts, begin messages, and tool configurations 2. Use Dynamic Variables in Your Prompts Dynamic variables work in : - Prompts (agent instructions and personality) - Begin message (opening greeting) - Tool configurations (custom function URLs, tool descriptions, property descriptions) - Call handling (voicemail prompts, transfer call phone numbers, warm transfer instructions) - Webhook URLs 3. Variable Persistence During Agent Transfer When using Agent Transfer, "the following settings of the first agent will be used throughout the call: optInSignedUrl, optOutSensitiveDataStorage, webHookUrl" [(2) ]() . The destination agent has access to the full conversation history . Key Limitation for Your Scenario: Since you're transferring immediately before conversation starts, there's minimal conversation context. The solution is to set variables at the agent level as defaults on both agents, ensuring they're available throughout the call session [(1) ]() . **Why Agent Transfer Over Call
Transfer:** - **Lower Latency**: Near-instant transition, much lower than call transfer [(2) ]() - **Better Reliability**: No new phone call creation, avoiding potential telephony failures - **No Handoff Message Needed**: Full conversation history access eliminates repeated customer questions - **No Separate Numbers**: Agents don't need their own phone numbers The variables should persist through the conversation context when properly configured at the agent level [(1) ]() [(2) ]() .
​ To learn more, see the sources I considered: [[1] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] Agent Transfer Node](https://docs.retellai.com/build/conversation-flow/transfer-agent-node) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
Can you link me to the documentation for the code block? I just need to know how to access all the dynamic variables and then to set them @AI Evy
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer For accessing and setting dynamic variables in a Code Node, here's the documentation: **Code Node Documentation**: Check out the [Node Overview]() which lists the Code Node as one of the available action nodes that "Execute JavaScript code directly without an external server" [(1) ]() . **Dynamic Variables Documentation**: The comprehensive guide for working with dynamic variables is at [Dynamic Variables]() [(2) ]() . Key Points for Accessing Dynamic Variables: Dynamic variables use the
{{variable_name}}
syntax and can be accessed in various contexts including prompts, tool configurations, and call handling . Setting Dynamic Variables: You can configure agent-level default dynamic variables which serve as fallback values when specific variables aren't included in the call request . The documentation explains that "Default variables serve as a fallback and will only be used when specific variables aren't included in the call request" . Nested Variables Support: Retell supports nested variables using syntax like
{{current_time_{{my_timezone}}}}
. For the specific Code Node implementation details and how to programmatically access all dynamic variables within a code block, I recommend reviewing the Node Overview documentation [(1) ]() which covers the Code Node as part of the conversation flow system.
​ To learn more, see the sources I considered: [[1] Node Overview](https://docs.retellai.com/build/conversation-flow/node) [[2] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.