amazon-bedrock-samples icon indicating copy to clipboard operation
amazon-bedrock-samples copied to clipboard

Inline Agents fails with Sonnet 3.5

Open austinmw opened this issue 9 months ago • 1 comments

agents-and-function-calling/bedrock-agents/features-examples/15-invoke-inline-agents/inline-agent-api-usage.ipynb fails with when attempting to use Sonnet 3.5 instead of Sonnet 3.0:

{
	"name": "EventStreamError",
	"message": "An error occurred (validationException) when calling the InvokeInlineAgent operation: Validation failed for inline agent: messages.2.content.0.tool_result.tool_use_id: Field required
It can be due to following reasons
1. The tools/functions have changed.
2. Model is changed across turns and this action is not supported.
",
	"stack": "---------------------------------------------------------------------------
EventStreamError                          Traceback (most recent call last)
Cell In[2], line 21
      4 response = client.invoke_inline_agent(
      5     actionGroups=[
      6         {
   (...)
     16     sessionId='session-1'
     17 )
     19 eventstream = response.get('completion')
---> 21 for event in eventstream:
     22     print(event)

File ~/.pyenv/versions/3.11.8/lib/python3.11/site-packages/botocore/eventstream.py:592, in EventStream.__iter__(self)
    590 def __iter__(self):
    591     for event in self._event_generator:
--> 592         parsed_event = self._parse_event(event)
    593         if parsed_event:
    594             yield parsed_event

File ~/.pyenv/versions/3.11.8/lib/python3.11/site-packages/botocore/eventstream.py:608, in EventStream._parse_event(self, event)
    606     return parsed_response
    607 else:
--> 608     raise EventStreamError(parsed_response, self._operation_name)

EventStreamError: An error occurred (validationException) when calling the InvokeInlineAgent operation: Validation failed for inline agent: messages.2.content.0.tool_result.tool_use_id: Field required
It can be due to following reasons
1. The tools/functions have changed.
2. Model is changed across turns and this action is not supported.
"
}

austinmw avatar Jan 06 '25 19:01 austinmw