豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/agents/realtime/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,9 +693,11 @@ async def _handle_tool_call(
# Update current agent
self._current_agent = result

# Get updated model settings from new agent
# Get updated model settings from new agent, preserving transport-configured
# settings (e.g. audio format) from initial_model_settings so they are not
# reset to defaults during the handoff session update.
updated_settings = await self._get_updated_model_settings_from_agent(
starting_settings=None,
starting_settings=self._model_config.get("initial_model_settings", None),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Limit handoff merge to transport-safe model settings

Passing initial_model_settings into _get_updated_model_settings_from_agent on handoff causes those values to overwrite agent-derived fields, because that helper applies starting_settings after computing instructions, tools, and handoffs. If a caller sets any of those keys in initial_model_settings (they are valid RealtimeSessionModelSettings fields), a handoff will keep the original configuration instead of switching to the new agent’s behavior. Previously this path passed None, so the new agent settings were preserved.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Limit handoff merge to transport-safe settings

Passing full initial_model_settings into handoff recomputation can stop the new agent from taking effect when users include instructions, tools, handoffs, or prompt there. Fresh evidence in the current tree: _get_updated_model_settings_from_agent computes agent-derived values and then applies starting_settings with update, so this new call path restores the original values on every handoff. In those configurations, the session.update after handoff keeps old behavior instead of switching to the target agent, so only transport-safe fields (like audio formats) should be preserved here.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid overriding handoff agent settings with initial session config

Passing self._model_config["initial_model_settings"] into the handoff path causes _get_updated_model_settings_from_agent to reapply any instructions, tools, handoffs, or prompt from startup config after the new agent is resolved. In sessions that set any of those keys in initial_model_settings, handoff no longer switches model behavior to the target agent and may keep using the original tool/handoff set. This regression is introduced by the new starting_settings=... call here; preserve only transport-safe fields (for example audio format) instead of the full settings dict.

Useful? React with 👍 / 👎.

agent=self._current_agent,
)

Expand Down