Initial Checks
Description
when using agent with output_type of a function and running it using agent.to_cli_sync() the parameters of the function is streamed and the function is called for each new token of its parameters.
Example Code
from pydantic_ai import Agent
def output_func(output: str) -> list[str]:
print("CALLED WITH:", output)
# parameter to the function could be for example an SQL query and result with error or execution of partial redundant query
return output.split()
model = OpenAIChatModel(
MODEL_NAME,
provider=AzureProvider(
azure_endpoint=ENDPOINT,
api_version=API_VERSION,
api_key=API_KEY,
),
)
agent = Agent(model, system_prompt="You are a helpful Assistant", output_type=output_func)
agent.to_cli_sync()
Python, Pydantic AI & LLM client version
using gpt-4o-mini from AzureOpenAI, Python 3.13.5 and pydantic-ai==1.0.0b1