Skip to content

[HANDS-ON BUG] Unit 2.1 Bedrock converse invocation issue #593

@AlessandroPecchini

Description

@AlessandroPecchini

Describe the bug
Hi!
I'm trying to reproduce the steps in the course using the AmazonBedrockServerModel.
While the CodeAgent works well the ToolCallingAgent gives me following error:

AgentGenerationError: Error while generating output: Parameter validation failed: Unknown parameter in input: "tools", must be one of: modelId, messages, system, inferenceConfig, toolConfig, guardrailConfig, additionalModelRequestFields, promptVariables, additionalModelResponseFieldPaths, requestMetadata, performanceConfig Unknown parameter in input: "tool_choice", must be one of: modelId, messages, system, inferenceConfig, toolConfig, guardrailConfig, additionalModelRequestFields, promptVariables, additionalModelResponseFieldPaths, requestMetadata, performanceConfig
I made some research and I found out that the issue is in the way the converse arguments are built.
Specifically in the line 1855 of the models.py file.
The json built to invoke the bedrock converse API is attached to this issue and has, among the other parameters, the "tool" parameter on the same level of "modelId".
The boto3 library expects the tools dict to be injected into the argument "toolConfig" and to have a different structure. I leave here the link to the doc

converse_args.json

To Reproduce
I just leave here the snippet that gives me the error

from smolagents import ToolCallingAgent, DuckDuckGoSearchTool, AmazonBedrockModel, InferenceClientModel import boto3 MODEL_ID = 'eu.amazon.nova-lite-v1:0' session = boto3.Session(profile_name='profile-name') bedrock_client = session.client(service_name='bedrock-runtime', region_name='eu-west-1') model = AmazonBedrockModel(    model_id = MODEL_ID ,    client=bedrock_client ) web_agent = ToolCallingAgent(tools=[DuckDuckGoSearchTool()], model=model) web_agent.run("Search for the best music recommendations for a party at the Wayne's mansion.")

Additional context
Library versions:
boto3: 1.40.13
smolagents: 1.21.2
python: 3.13.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions