Skip to content

Python: [Bug]: AnthropicClient TypeError: AsyncMessages.create() got an unexpected keyword argument 'allow_multiple_tool_calls' #3371

@leelakarthik

Description

@leelakarthik

Description

when indiviual agent is run its working fine, but not with the orchestrator (handoff). The code sample for anthropic_basic works fine but when create two basic agent and add in orchestrator issue occurs

Code Sample

async for event in workflow.run_stream(user_input):
        # print("event:", event)
        if isinstance(event, RequestInfoEvent):
            pending_requests.append(event)

Error Messages / Stack Traces

Traceback (most recent call last):
  File "/Users/karthik/Code bases/maf_ast_agents zip/Anthropic-Agent/main.py", line 109, in <module>
    cli()
    ~~~^^
  File "/Users/karthik/Code bases/maf_ast_agents zip/Anthropic-Agent/main.py", line 105, in cli
    asyncio.run(main())
    ~~~~~~~~~~~^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.13.11/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 195, in run
    return runner.run(main)
           ~~~~~~~~~~^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.13.11/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.13.11/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/Users/karthik/Code bases/maf_ast_agents zip/Anthropic-Agent/main.py", line 97, in main
    await run_interactive_session(
    ...<2 lines>...
    )
  File "/Users/karthik/Code bases/maf_ast_agents zip/Anthropic-Agent/workflow.py", line 133, in run_interactive_session
    async for event in workflow.run_stream(user_input):
    ...<2 lines>...
            pending_requests.append(event)
  File "/Users/karthik/Code bases/maf_ast_agents zip/.venv/lib/python3.13/site-packages/agent_framework/_workflows/_workflow.py", line 533, in run_stream
    async for event in self._run_workflow_with_tracing(
    ...<7 lines>...
        yield event
  File "/Users/karthik/Code bases/maf_ast_agents zip/.venv/lib/python3.13/site-packages/agent_framework/_workflows/_workflow.py", line 343, in _run_workflow_with_tracing
    await initial_executor_fn()
  File "/Users/karthik/Code bases/maf_ast_agents zip/.venv/lib/python3.13/site-packages/agent_framework/_workflows/_workflow.py", line 427, in _execute_with_message_or_checkpoint
    await executor.execute(
    ...<6 lines>...
    )
  File "/Users/karthik/Code bases/maf_ast_agents zip/.venv/lib/python3.13/site-packages/agent_framework/_workflows/_executor.py", line 277, in execute
    await handler(message, context)
  File "/Users/karthik/Code bases/maf_ast_agents zip/.venv/lib/python3.13/site-packages/agent_framework/_workflows/_executor.py", line 567, in wrapper
    return await func(self, message, ctx)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/karthik/Code bases/maf_ast_agents zip/.venv/lib/python3.13/site-packages/agent_framework/_workflows/_agent_executor.py", line 157, in from_str
    await self._run_agent_and_emit(ctx)
  File "/Users/karthik/Code bases/maf_ast_agents zip/.venv/lib/python3.13/site-packages/agent_framework/_workflows/_handoff.py", line 386, in _run_agent_and_emit
    response = await self._run_agent_streaming(cast(WorkflowContext, ctx))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/karthik/Code bases/maf_ast_agents zip/.venv/lib/python3.13/site-packages/agent_framework/_workflows/_agent_executor.py", line 366, in _run_agent_streaming
    async for update in self._agent.run_stream(
    ...<8 lines>...
            user_input_requests.extend(update.user_input_requests)
  File "/Users/karthik/Code bases/maf_ast_agents zip/.venv/lib/python3.13/site-packages/agent_framework/observability.py", line 1411, in trace_run_streaming
    async for streaming_agent_response in run_streaming_func(self, messages=messages, thread=thread, **kwargs):
        yield streaming_agent_response
  File "/Users/karthik/Code bases/maf_ast_agents zip/.venv/lib/python3.13/site-packages/agent_framework/_agents.py", line 982, in run_stream
    async for update in self.chat_client.get_streaming_response(
    ...<18 lines>...
        )
  File "/Users/karthik/Code bases/maf_ast_agents zip/.venv/lib/python3.13/site-packages/agent_framework/_tools.py", line 2120, in streaming_function_invocation_wrapper
    async for update in func(self, messages=prepped_messages, options=options, **filtered_kwargs):
        all_updates.append(update)
        yield update
  File "/Users/karthik/Code bases/maf_ast_agents zip/.venv/lib/python3.13/site-packages/agent_framework/observability.py", line 1163, in trace_get_streaming_response
    async for update in func(self, messages=messages, options=options, **kwargs):
        yield update
  File "/Users/karthik/Code bases/maf_ast_agents zip/.venv/lib/python3.13/site-packages/agent_framework/_middleware.py", line 1432, in _stream_generator
    async for update in original_get_streaming_response(
    ...<5 lines>...
        yield update
  File "/Users/karthik/Code bases/maf_ast_agents zip/.venv/lib/python3.13/site-packages/agent_framework/_clients.py", line 362, in get_streaming_response
    async for update in self._inner_get_streaming_response(
    ...<4 lines>...
        yield update
  File "/Users/karthik/Code bases/maf_ast_agents zip/.venv/lib/python3.13/site-packages/agent_framework_anthropic/_chat_client.py", line 369, in _inner_get_streaming_response
    async for chunk in await self.anthropic_client.beta.messages.create(**run_options, stream=True):
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/karthik/Code bases/maf_ast_agents zip/.venv/lib/python3.13/site-packages/anthropic/_utils/_utils.py", line 282, in wrapper
    return func(*args, **kwargs)
TypeError: AsyncMessages.create() got an unexpected keyword argument 'allow_multiple_tool_calls'

Package Versions

Microsoft Agent Framework (pre-release) agent-framework[all]>=1.0.0b260116 # Anthropic SDK with Foundry support anthropic>=0.76.0

Python Version

3.13

Additional Context

not been able to fix the issue

Metadata

Metadata

Labels

bugSomething isn't workingmodel clientsIssues related to the model client implementationspythonv1.0Features being tracked for the version 1.0 GA

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions