Closed
Description
Please read this first
- Have you read the docs?Agents SDK docs
- Have you searched for related issues? Others may have faced similar issues.
Describe the bug
Nested arrays/objects of a Pydantic type are not passed to function tool arguments.
I have these classes:
class Exercise(BaseModel):
...
class Workout(BaseModel):
exercises: List[Exercise]
class TrainingProgram(BaseModel):
workouts: List[Workout]
function tool calls seem to always have the workouts list empty
Debug information
- Agents SDK version: 0.0.11
- Python version 3.10.13
Repro steps
I have a function tool defined as so:
@function_tool
async def create_training_program(wrapper: RunContextWrapper[ChatContext], training_program: TrainingProgram)
when one of my agents calls it, the workouts array is empty
create_training_program({
"training_program": {
"daysPerWeek": <populated correctly>,
"workouts": [],
"notes": <populated correctly>
}
})
the weird thing is I ask the agent to create the training program, call the tool, and hand it off to another agent. The handoff also has the workouts array blank:
transfer_to_x_agent({
"program": {
"daysPerWeek": <populated correctly>,
"workouts": [],
"notes": <populated correctly>
},
})
but the agent it hands off is able to correctly display the entire training program to the user. so the missing is data is somewhere, but just not in the function tool calls?
Expected behavior
I expected the workouts list on TrainingProgram to be populated