Skip to content

[BUG] AmazonBedrockServerModel doesnt work with ToolCallingAgent #1432

@cmclel7

Description

@cmclel7

Describe the bug
When using an AmazonBedrockServerModel as the model for a ToolCallingAgent any inference request will throw an error. The error looks to be from Bedrock due to the tools not being configured correctly.

Code to reproduce the error

import boto3

from smolagents import (
    AmazonBedrockServerModel,
    ToolCallingAgent,
    WikipediaSearchTool,
    VisitWebpageTool,
)

client = boto3.client("bedrock-runtime")
bedrock_model = AmazonBedrockServerModel(model_id="us.amazon.nova-lite-v1:0", client=client)

manager_agent = ToolCallingAgent(
            tools=[
                WikipediaSearchTool(),
                VisitWebpageTool(),
            ],
            model=bedrock_model,
            max_steps=10,
            planning_interval=1,
            additional_authorized_imports=[],
            managed_agents=[],
        )

Error logs (if any)

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

Expected behavior
ToolCallingAgent should be able to inference with Bedrock models with tool calling capabilities.

Packages version:
1.17.0

Additional context
CodeAgent works as expected.
@leandrodamascena

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions