Skip to main content
Teams can generate structured data using Pydantic models, just like individual agents. This feature is perfect for coordinated data extraction, analysis, and report generation where multiple agents work together to produce a structured result.

Example

Let’s create a Stock Research Team that produces a structured StockReport.
research_team.py
The team will coordinate between its members and produce a structured ResearchReport object:

Using a Parser Model

You can use an additional model to parse and structure the output from your primary model. This approach is particularly effective when the primary model is optimized for reasoning tasks, as such models may not consistently produce detailed structured responses.
You can also provide a custom parser_model_prompt to your Parser Model.

Streaming Structured Output

Teams support streaming with structured output, where the content event contains the complete structured result as a single event.
streaming_team.py
When streaming with teams and structured output, you’ll see intermediate steps from individual team members, but the final structured result is delivered as a single complete chunk rather than being streamed progressively.

Developer Resources