fix: Ensure safe assignment to tool_blocks_map in agent_message handling (#5239)
fix: ensure tool_blocks_map assignment is safe by checking content availability in agent_message
This commit is contained in:
parent
c6b1eaba60
commit
222f15d8a1
1 changed files with 2 additions and 1 deletions
|
|
@ -149,7 +149,8 @@ async def handle_on_tool_start(
|
|||
agent_message.content_blocks[0].contents.append(tool_content)
|
||||
|
||||
agent_message = await send_message_method(message=agent_message)
|
||||
tool_blocks_map[tool_key] = agent_message.content_blocks[0].contents[-1]
|
||||
if agent_message.content_blocks and agent_message.content_blocks[0].contents:
|
||||
tool_blocks_map[tool_key] = agent_message.content_blocks[0].contents[-1]
|
||||
return agent_message, new_start_time
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue