Skip to content

Nested objects in function tool input are empty #563

Closed
@built-by-as

Description

@built-by-as

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions