Structured outputs in agent teams

I am trying to use structured_outputs in agent team with model as AzureOpenAI but it is failing with error:

ValueError: `transfer_task_to_agent` is not strict. Only `strict` function tools can be auto-parsed

If I don’t use the structured output, it works fine.

Hi @Souvik
Thanks for reaching out and for using Agno! I’ve looped in the right engineers to help with your question. We usually respond within 24 hours, but if this is urgent, just let us know, and we’ll do our best to prioritize it.
Appreciate your patience—we’ll get back to you soon! :smile:

Hi @Monali,

Yes its a bit urgent and I would really appreciate if I could get a resolution on this

Hey @Souvik apologies for the delay in response. Can you please help me with how you’re passing the structured_outputs ? It works on the team leader, but it can be messed up on the team member.

We are revamping teams to make this a lot better. But please let me know more about your team’s agents configuration.

Hi @priti,
I am passing a class extended from pydantic BaseModel as the response_model and structured_output as True to the team lead but its failing with the error I mentioned above.

To give you more context, I have a Team lead that has agents to delegate tasks, the team lead’s objective is to format whatever responses these sub agents are bringing with the response model provided.

However, when I tested the structured output in the sub agent individually, it gave proper results.

@Souvik we did fix this in our latest versions. Can you try with agno > 1.1.5?

If it still doesn’t work, I can suggest you remove structured_output=True and just pass the response_model. We have examples of this that does indeed work.

Hi @Dirk,

I was actually debugging through it and it seems the ‘response_model’ object should be present in the member agent as well to make this work
(line no 2460 in agent.py)
strict = True if (member_agent.response_model is not None and member_agent.model is not None) else False

but now , the challenge is, when I am using response_models in the lead agent, updating agent memory fails as it is somehow defaulting to OpenAI model instead of the AzureOpenAI model that I am passing in the AgentMemory class.

Also, one small feedback, please update the documentation of AgentMemory to mention that in order to generate summary and update the memory with custom models , we need to pass the custom model in classifier and summerizer

Hi @Souvik
Sorry, our current teams implementation is incomplete. We are working on a complete revamp of teams (there is a draft PR out, so it is in advanced stages of development) where all of the current issues would ideally be addressed.

And yes, we will update the documentation, thanks for the suggestion.