Example
Let’s create a Stock Research Team that produces a structuredStockReport.
research_team.py
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.parser_model_prompt to your Parser Model.
Streaming Structured Output
Teams support streaming with structured output, where thecontent 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.