Managing response_model from different agents

what would happen in a team of agents, when agents use different response models (different pydantic schema)?

in addition, should the response model of the team be a superset of the agents response models?

Hi, Thank you for your question

Yes — agents in a team can each have their own response models (custom Pydantic schemas), and that works fine. But when you’re calling team.arun(), the team itself also needs a response_model, and that’s where things get important.

What happens if agents return different models?

Agno expects the team’s response to conform to a single schema, so if different agents return different formats:

  • You may run into validation errors
  • Or some outputs may get lost if they don’t fit the expected schema

Recommended Approach

Set the team’s response_model to be a superset or union of the possible responses from individual agents.

You can do this by:

  • Using Optional fields for everything that might appear
  • Or wrapping the agent models in a Union type

This way, the team can successfully parse and return any of the agent responses without issue.