Skip to content

Handoff does not work with Claude 3.7 Sonnet #270

Open
@nishant-satpathy

Description

@nishant-satpathy

I am attempting use claude-3.7-sonnet with the Agents SDK. I have it set up like this:

claude_client = AsyncOpenAI(
    base_url="https://api.anthropic.com/v1/", 
    api_key=os.getenv("ANTHROPIC_API_KEY")
)

manager_agent = Agent(
    name="Manager Agent",
    instructions="""You are a manager who will decide which sub agent to handoff the input to based on the user's input. 
    """,
    model=OpenAIChatCompletionsModel(model="claude-3-7-sonnet-20250219", openai_client=claude_client),
    handoffs=[agent_1, agent_2, agent_3, agent_4]
)

When I execute this, I get the following error:

openai.BadRequestError: Error code: 400 - {'error': {'message': "Invalid 'input[1].id': '__fake_id__'. Expected an ID that begins with 'msg'.", 'type': 'invalid_request_error', 'param': 'input[1].id', 'code': 'invalid_value'}}

I noticed that there was some documentation around __fake_id__ here:

FAKE_RESPONSES_ID = "__fake_id__"
"""This is a placeholder ID used to fill in the `id` field in Responses API related objects. It's
useful when you're creating Responses objects from non-Responses APIs, e.g. the OpenAI Chat
Completions API or other LLM providers.
"""

From the examples, it looks like we have to use OpenAIChatCompletionsModel for using an LLM not provided by OpenAI, so does this mean that handoffs are not possible with any non OpenAI LLM?

Side Note: I noticed that there was a comment on issue #120 that mentions that if the model does not support tool calling, handoff calling is not supported, but claude-3.7 does support tool calling IIRC.

Would appreciate any insights on this, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionQuestion about using the SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions