Skip to content

Question about Agent returning both a tool call and a final output in the same response #1806

@domino14

Description

@domino14

I have an agent with tool use. Sometimes it outputs both a final response (using the structured output format I gave it) AND a function call.

Image

The issue is that the Agent SDK thinks it is done once it sees this final output. So even though we call the function, the SDK never sends the output of the function back to the LLM, and thus the agent doesn't get the chance to correct any mistakes in the function call, or make further function calls, etc.

Is there a way in the SDK to make it so that if it returns both an output AND a function call, to ignore the output? Or any suggestions for making it not return both in one single API call?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion about using the SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions