Closed
Description
Please read this first
- Have you read the docs?Agents SDK docs: Yes
- Have you searched for related issues? Others may have had similar requests: Yes
Question
I'd like to enforce LLM to chain-of-thought and step by step tool calls and ultimately want to return a structured output built with a Pydantic model. To achieve that, I'm using StopAtTools and stop when structured output is built.
tool_use_behavior = StopAtTools(stop_at_tool_names=[build_output.name])
where
@function_tool
def build_output(foo: Foo):
return foo
Today I can make this work by calling run_streamed, inspecting each interim tool-call result, and returning when the build_output call of the wanted type appears.
Is there a way to achieve the same thing without using run_streamed?