Skip to content

Python: [Bug]: BedrockChatClient sends toolConfig.toolChoice without toolConfig.tools when agent has no tools #5165

@gourab-aiplanet

Description

@gourab-aiplanet

Description

When using BedrockChatClient with an Agent that has no tools configured, the client still sends toolConfig.toolChoice to the Bedrock API. This causes a validation error because AWS Bedrock requires toolConfig.tools to be present whenever toolConfig.toolChoice is specified.

Code Sample

import asyncio
from agent_framework import Agent
from agent_framework_bedrock import BedrockChatClient

async def main():
    client = BedrockChatClient(
        access_key="...",
        secret_key="...",
        region="eu-west-1",
        model="anthropic.claude-sonnet-4-6"
    )

    # Agent with no tools
    agent = Agent(
        client=client,
        name="TestAgent",
        instructions="You are a helpful assistant",
        tools=None,  # No tools
        default_options=None,  # No tool options
    )

    # This fails with ParamValidationError
    result = await agent.run("What is AI?")
    print(result)

asyncio.run(main())

Error Messages / Stack Traces

botocore.exceptions.ParamValidationError: Parameter validation failed:
Missing required parameter in toolConfig: "tools"

Package Versions

agent-framework-bedrock version: 1.0.0b260402

Python Version

Python version: 3.10+

Additional Context

Expected behavior

When no tools are provided to the agent, the BedrockChatClient should NOT include toolConfig in the API request at all. This is similar to how PR #4535 fixed the tool_choice="none" case by omitting toolConfig entirely.

Actual behavior

The client sends a request with toolConfig.toolChoice (likely defaulting to {"auto": {}}) but without toolConfig.tools, causing AWS Bedrock to reject the request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions