> ## Documentation Index
> Fetch the complete documentation index at: https://phidatainc-agui.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# TeamRunOutput

The `TeamRunOutput` class represents the response from a team run, containing both the team's overall response and individual member responses. It supports streaming and provides real-time events throughout the execution of a team.

## TeamRunOutput Attributes

| Attribute             | Type                                              | Default             | Description                                 |
| --------------------- | ------------------------------------------------- | ------------------- | ------------------------------------------- |
| `content`             | `Any`                                             | `None`              | Content of the response                     |
| `content_type`        | `str`                                             | `"str"`             | Specifies the data type of the content      |
| `messages`            | `List[Message]`                                   | `None`              | A list of messages included in the response |
| `metrics`             | `Optional[RunMetrics]`                            | `None`              | Usage metrics of the run                    |
| `model`               | `str`                                             | `None`              | The model used in the run                   |
| `model_provider`      | `str`                                             | `None`              | The model provider used in the run          |
| `member_responses`    | `List[Union[TeamRunOutput, RunOutput]]`           | `[]`                | Responses from individual team members      |
| `run_id`              | `str`                                             | `None`              | Run Id                                      |
| `team_id`             | `str`                                             | `None`              | Team Id for the run                         |
| `team_name`           | `str`                                             | `None`              | Name of the team                            |
| `session_id`          | `str`                                             | `None`              | Session Id for the run                      |
| `parent_run_id`       | `str`                                             | `None`              | Parent run ID if this is a nested run       |
| `user_id`             | `str`                                             | `None`              | User Id for the run                         |
| `tools`               | `List[ToolExecution]`                             | `None`              | List of tools provided to the model         |
| `images`              | `List[Image]`                                     | `None`              | List of images from member runs             |
| `videos`              | `List[Video]`                                     | `None`              | List of videos from member runs             |
| `audio`               | `List[Audio]`                                     | `None`              | List of audio snippets from member runs     |
| `files`               | `List[File]`                                      | `None`              | List of files from member runs              |
| `response_audio`      | `Audio`                                           | `None`              | The model's raw response in audio           |
| `input`               | `TeamRunInput`                                    | `None`              | Input media and messages from user          |
| `reasoning_content`   | `str`                                             | `None`              | Any reasoning content the model produced    |
| `citations`           | `Citations`                                       | `None`              | Any citations used in the response          |
| `model_provider_data` | `Any`                                             | `None`              | Model provider specific metadata            |
| `metadata`            | `Dict[str, Any]`                                  | `None`              | Additional metadata for the run             |
| `session_state`       | `Dict[str, Any]`                                  | `None`              | Session state for the run                   |
| `references`          | `List[MessageReferences]`                         | `None`              | Message references                          |
| `additional_input`    | `List[Message]`                                   | `None`              | Additional input messages                   |
| `reasoning_steps`     | `List[ReasoningStep]`                             | `None`              | Reasoning steps taken during execution      |
| `reasoning_messages`  | `List[Message]`                                   | `None`              | Messages related to reasoning               |
| `created_at`          | `int`                                             | Current timestamp   | Unix timestamp of the response creation     |
| `events`              | `List[Union[RunOutputEvent, TeamRunOutputEvent]]` | `None`              | List of events that occurred during the run |
| `status`              | `RunStatus`                                       | `RunStatus.running` | Current status of the run                   |
| `requirements`        | `List[RunRequirement]`                            | `None`              | HITL requirements to continue a paused run  |
| `workflow_step_id`    | `str`                                             | `None`              | FK: Points to StepOutput.step\_id           |

## TeamRunOutputEvent Types

The following events are sent by the `Team.run()` function depending on the team's configuration:

### Core Events

| Event Type                   | Description                                                 |
| ---------------------------- | ----------------------------------------------------------- |
| `TeamRunStarted`             | Indicates the start of a team run                           |
| `TeamRunContent`             | Contains the model's response text as individual chunks     |
| `TeamRunContentCompleted`    | Signals completion of content streaming                     |
| `TeamRunIntermediateContent` | Contains intermediate content during the run                |
| `TeamRunCompleted`           | Signals successful completion of the team run               |
| `TeamRunError`               | Indicates an error occurred during the team run             |
| `TeamRunCancelled`           | Signals that the team run was cancelled                     |
| `TeamRunPaused`              | Indicates that the team run is paused for HITL requirements |
| `TeamRunContinued`           | Indicates that a paused team run has continued              |

### Pre-Hook Events

| Event Type             | Description                                    |
| ---------------------- | ---------------------------------------------- |
| `TeamPreHookStarted`   | Indicates the start of a pre-run hook          |
| `TeamPreHookCompleted` | Signals completion of a pre-run hook execution |

### Post-Hook Events

| Event Type              | Description                                     |
| ----------------------- | ----------------------------------------------- |
| `TeamPostHookStarted`   | Indicates the start of a post-run hook          |
| `TeamPostHookCompleted` | Signals completion of a post-run hook execution |

### Tool Events

| Event Type              | Description                                                    |
| ----------------------- | -------------------------------------------------------------- |
| `TeamToolCallStarted`   | Indicates the start of a tool call                             |
| `TeamToolCallCompleted` | Signals completion of a tool call, including tool call results |
| `TeamToolCallError`     | Indicates a tool call error                                    |

### Reasoning Events

| Event Type                  | Description                                         |
| --------------------------- | --------------------------------------------------- |
| `TeamReasoningStarted`      | Indicates the start of the team's reasoning process |
| `TeamReasoningStep`         | Contains a single step in the reasoning process     |
| `TeamReasoningContentDelta` | Streams reasoning content chunks                    |
| `TeamReasoningCompleted`    | Signals completion of the reasoning process         |

### Memory Events

| Event Type                  | Description                                    |
| --------------------------- | ---------------------------------------------- |
| `TeamMemoryUpdateStarted`   | Indicates that the team is updating its memory |
| `TeamMemoryUpdateCompleted` | Signals completion of a memory update          |

### Session Summary Events

| Event Type                    | Description                                       |
| ----------------------------- | ------------------------------------------------- |
| `TeamSessionSummaryStarted`   | Indicates the start of session summary generation |
| `TeamSessionSummaryCompleted` | Signals completion of session summary generation  |

### Parser Model Events

| Event Type                         | Description                                  |
| ---------------------------------- | -------------------------------------------- |
| `TeamParserModelResponseStarted`   | Indicates the start of parser model response |
| `TeamParserModelResponseCompleted` | Signals completion of parser model response  |

### Output Model Events

| Event Type                         | Description                                  |
| ---------------------------------- | -------------------------------------------- |
| `TeamOutputModelResponseStarted`   | Indicates the start of output model response |
| `TeamOutputModelResponseCompleted` | Signals completion of output model response  |

### Model Request Events

| Event Type                  | Description                            |
| --------------------------- | -------------------------------------- |
| `TeamModelRequestStarted`   | Indicates the start of a model request |
| `TeamModelRequestCompleted` | Signals completion of a model request  |

### Compression Events

| Event Type                 | Description                                    |
| -------------------------- | ---------------------------------------------- |
| `TeamCompressionStarted`   | Indicates the start of tool result compression |
| `TeamCompressionCompleted` | Signals completion of tool result compression  |

### Custom Events

| Event Type    | Description                      |
| ------------- | -------------------------------- |
| `CustomEvent` | Custom event emitted by the team |

## Event Attributes

### Base TeamRunOutputEvent

All events inherit from `BaseTeamRunEvent` which provides these common attributes:

| Attribute         | Type            | Default           | Description                           |
| ----------------- | --------------- | ----------------- | ------------------------------------- |
| `created_at`      | `int`           | Current timestamp | Unix timestamp of the event creation  |
| `event`           | `str`           | `""`              | The type of event                     |
| `team_id`         | `str`           | `""`              | ID of the team generating the event   |
| `team_name`       | `str`           | `""`              | Name of the team generating the event |
| `run_id`          | `Optional[str]` | `None`            | ID of the current run                 |
| `parent_run_id`   | `Optional[str]` | `None`            | Parent run ID if this is a nested run |
| `session_id`      | `Optional[str]` | `None`            | ID of the current session             |
| `workflow_id`     | `Optional[str]` | `None`            | ID of the workflow                    |
| `workflow_run_id` | `Optional[str]` | `None`            | ID of the workflow's run              |
| `step_id`         | `Optional[str]` | `None`            | ID of the workflow step               |
| `step_name`       | `Optional[str]` | `None`            | Name of the workflow step             |
| `step_index`      | `Optional[int]` | `None`            | Index of the workflow step            |
| `content`         | `Optional[Any]` | `None`            | For backwards compatibility           |

### RunStartedEvent

| Attribute        | Type  | Default            | Description               |
| ---------------- | ----- | ------------------ | ------------------------- |
| `event`          | `str` | `"TeamRunStarted"` | Event type                |
| `model`          | `str` | `""`               | The model being used      |
| `model_provider` | `str` | `""`               | The provider of the model |

### IntermediateRunContentEvent

| Attribute      | Type            | Default                        | Description                          |
| -------------- | --------------- | ------------------------------ | ------------------------------------ |
| `event`        | `str`           | `"TeamRunIntermediateContent"` | Event type                           |
| `content`      | `Optional[Any]` | `None`                         | Intermediate content of the response |
| `content_type` | `str`           | `"str"`                        | Type of the content                  |

### RunContentCompletedEvent

| Attribute | Type  | Default                     | Description |
| --------- | ----- | --------------------------- | ----------- |
| `event`   | `str` | `"TeamRunContentCompleted"` | Event type  |

### RunContentEvent

| Attribute             | Type                                | Default            | Description                      |
| --------------------- | ----------------------------------- | ------------------ | -------------------------------- |
| `event`               | `str`                               | `"TeamRunContent"` | Event type                       |
| `content`             | `Optional[Any]`                     | `None`             | The content of the response      |
| `content_type`        | `str`                               | `"str"`            | Type of the content              |
| `reasoning_content`   | `Optional[str]`                     | `None`             | Reasoning content produced       |
| `citations`           | `Optional[Citations]`               | `None`             | Citations used in the response   |
| `model_provider_data` | `Optional[Any]`                     | `None`             | Model provider specific metadata |
| `response_audio`      | `Optional[Audio]`                   | `None`             | Model's audio response           |
| `image`               | `Optional[Image]`                   | `None`             | Image attached to the response   |
| `references`          | `Optional[List[MessageReferences]]` | `None`             | Message references               |
| `additional_input`    | `Optional[List[Message]]`           | `None`             | Additional input messages        |
| `reasoning_steps`     | `Optional[List[ReasoningStep]]`     | `None`             | Reasoning steps                  |
| `reasoning_messages`  | `Optional[List[Message]]`           | `None`             | Reasoning messages               |

### RunCompletedEvent

| Attribute             | Type                                    | Default              | Description                             |
| --------------------- | --------------------------------------- | -------------------- | --------------------------------------- |
| `event`               | `str`                                   | `"TeamRunCompleted"` | Event type                              |
| `content`             | `Optional[Any]`                         | `None`               | Final content of the response           |
| `content_type`        | `str`                                   | `"str"`              | Type of the content                     |
| `reasoning_content`   | `Optional[str]`                         | `None`               | Reasoning content produced              |
| `citations`           | `Optional[Citations]`                   | `None`               | Citations used in the response          |
| `model_provider_data` | `Optional[Any]`                         | `None`               | Model provider specific metadata        |
| `images`              | `Optional[List[Image]]`                 | `None`               | Images attached to the response         |
| `videos`              | `Optional[List[Video]]`                 | `None`               | Videos attached to the response         |
| `audio`               | `Optional[List[Audio]]`                 | `None`               | Audio snippets attached to the response |
| `response_audio`      | `Optional[Audio]`                       | `None`               | Model's audio response                  |
| `references`          | `Optional[List[MessageReferences]]`     | `None`               | Message references                      |
| `additional_input`    | `Optional[List[Message]]`               | `None`               | Additional input messages               |
| `reasoning_steps`     | `Optional[List[ReasoningStep]]`         | `None`               | Reasoning steps                         |
| `reasoning_messages`  | `Optional[List[Message]]`               | `None`               | Reasoning messages                      |
| `member_responses`    | `List[Union[TeamRunOutput, RunOutput]]` | `[]`                 | Responses from individual team members  |
| `metadata`            | `Optional[Dict[str, Any]]`              | `None`               | Additional metadata                     |
| `metrics`             | `Optional[RunMetrics]`                  | `None`               | Usage metrics                           |

### RunErrorEvent

| Attribute         | Type                       | Default          | Description           |
| ----------------- | -------------------------- | ---------------- | --------------------- |
| `event`           | `str`                      | `"TeamRunError"` | Event type            |
| `content`         | `Optional[str]`            | `None`           | Error message         |
| `error_type`      | `Optional[str]`            | `None`           | Error type            |
| `error_id`        | `Optional[str]`            | `None`           | Error identifier      |
| `additional_data` | `Optional[Dict[str, Any]]` | `None`           | Additional error data |

### RunCancelledEvent

| Attribute | Type            | Default              | Description             |
| --------- | --------------- | -------------------- | ----------------------- |
| `event`   | `str`           | `"TeamRunCancelled"` | Event type              |
| `reason`  | `Optional[str]` | `None`               | Reason for cancellation |

### RunPausedEvent

| Attribute      | Type                             | Default           | Description                              |
| -------------- | -------------------------------- | ----------------- | ---------------------------------------- |
| `event`        | `str`                            | `"TeamRunPaused"` | Event type                               |
| `tools`        | `Optional[List[ToolExecution]]`  | `None`            | Tool executions for pending requirements |
| `requirements` | `Optional[List[RunRequirement]]` | `None`            | HITL requirements for the run            |

### RunContinuedEvent

| Attribute | Type  | Default              | Description |
| --------- | ----- | -------------------- | ----------- |
| `event`   | `str` | `"TeamRunContinued"` | Event type  |

### PreHookStartedEvent

| Attribute       | Type                     | Default                | Description                         |
| --------------- | ------------------------ | ---------------------- | ----------------------------------- |
| `event`         | `str`                    | `"TeamPreHookStarted"` | Event type                          |
| `pre_hook_name` | `Optional[str]`          | `None`                 | Name of the pre-hook being executed |
| `run_input`     | `Optional[TeamRunInput]` | `None`                 | The run input passed to the hook    |

### PreHookCompletedEvent

| Attribute       | Type                     | Default                  | Description                         |
| --------------- | ------------------------ | ------------------------ | ----------------------------------- |
| `event`         | `str`                    | `"TeamPreHookCompleted"` | Event type                          |
| `pre_hook_name` | `Optional[str]`          | `None`                   | Name of the pre-hook that completed |
| `run_input`     | `Optional[TeamRunInput]` | `None`                   | The run input passed to the hook    |

### PostHookStartedEvent

| Attribute        | Type            | Default                 | Description                          |
| ---------------- | --------------- | ----------------------- | ------------------------------------ |
| `event`          | `str`           | `"TeamPostHookStarted"` | Event type                           |
| `post_hook_name` | `Optional[str]` | `None`                  | Name of the post-hook being executed |

### PostHookCompletedEvent

| Attribute        | Type            | Default                   | Description                          |
| ---------------- | --------------- | ------------------------- | ------------------------------------ |
| `event`          | `str`           | `"TeamPostHookCompleted"` | Event type                           |
| `post_hook_name` | `Optional[str]` | `None`                    | Name of the post-hook that completed |

### ToolCallStartedEvent

| Attribute | Type                      | Default                 | Description           |
| --------- | ------------------------- | ----------------------- | --------------------- |
| `event`   | `str`                     | `"TeamToolCallStarted"` | Event type            |
| `tool`    | `Optional[ToolExecution]` | `None`                  | The tool being called |

### ToolCallCompletedEvent

| Attribute | Type                      | Default                   | Description                 |
| --------- | ------------------------- | ------------------------- | --------------------------- |
| `event`   | `str`                     | `"TeamToolCallCompleted"` | Event type                  |
| `tool`    | `Optional[ToolExecution]` | `None`                    | The tool that was called    |
| `content` | `Optional[Any]`           | `None`                    | Result of the tool call     |
| `images`  | `Optional[List[Image]]`   | `None`                    | Images produced by the tool |
| `videos`  | `Optional[List[Video]]`   | `None`                    | Videos produced by the tool |
| `audio`   | `Optional[List[Audio]]`   | `None`                    | Audio produced by the tool  |

### ToolCallErrorEvent

| Attribute | Type                      | Default               | Description          |
| --------- | ------------------------- | --------------------- | -------------------- |
| `event`   | `str`                     | `"TeamToolCallError"` | Event type           |
| `tool`    | `Optional[ToolExecution]` | `None`                | The tool that failed |
| `error`   | `Optional[str]`           | `None`                | Error message        |

### ReasoningStartedEvent

| Attribute | Type  | Default                  | Description |
| --------- | ----- | ------------------------ | ----------- |
| `event`   | `str` | `"TeamReasoningStarted"` | Event type  |

### ReasoningStepEvent

| Attribute           | Type            | Default               | Description                   |
| ------------------- | --------------- | --------------------- | ----------------------------- |
| `event`             | `str`           | `"TeamReasoningStep"` | Event type                    |
| `content`           | `Optional[Any]` | `None`                | Content of the reasoning step |
| `content_type`      | `str`           | `"str"`               | Type of the content           |
| `reasoning_content` | `str`           | `""`                  | Detailed reasoning content    |

### ReasoningContentDeltaEvent

| Attribute           | Type  | Default                       | Description             |
| ------------------- | ----- | ----------------------------- | ----------------------- |
| `event`             | `str` | `"TeamReasoningContentDelta"` | Event type              |
| `reasoning_content` | `str` | `""`                          | Reasoning content chunk |

### ReasoningCompletedEvent

| Attribute      | Type            | Default                    | Description                   |
| -------------- | --------------- | -------------------------- | ----------------------------- |
| `event`        | `str`           | `"TeamReasoningCompleted"` | Event type                    |
| `content`      | `Optional[Any]` | `None`                     | Content of the reasoning step |
| `content_type` | `str`           | `"str"`                    | Type of the content           |

### MemoryUpdateStartedEvent

| Attribute | Type  | Default                     | Description |
| --------- | ----- | --------------------------- | ----------- |
| `event`   | `str` | `"TeamMemoryUpdateStarted"` | Event type  |

### MemoryUpdateCompletedEvent

| Attribute  | Type                  | Default                       | Description                 |
| ---------- | --------------------- | ----------------------------- | --------------------------- |
| `event`    | `str`                 | `"TeamMemoryUpdateCompleted"` | Event type                  |
| `memories` | `Optional[List[Any]]` | `None`                        | Memories updated by the run |

### SessionSummaryStartedEvent

| Attribute | Type  | Default                       | Description |
| --------- | ----- | ----------------------------- | ----------- |
| `event`   | `str` | `"TeamSessionSummaryStarted"` | Event type  |

### SessionSummaryCompletedEvent

| Attribute         | Type            | Default                         | Description                   |
| ----------------- | --------------- | ------------------------------- | ----------------------------- |
| `event`           | `str`           | `"TeamSessionSummaryCompleted"` | Event type                    |
| `session_summary` | `Optional[Any]` | `None`                          | The generated session summary |

### ParserModelResponseStartedEvent

| Attribute | Type  | Default                            | Description |
| --------- | ----- | ---------------------------------- | ----------- |
| `event`   | `str` | `"TeamParserModelResponseStarted"` | Event type  |

### ParserModelResponseCompletedEvent

| Attribute | Type  | Default                              | Description |
| --------- | ----- | ------------------------------------ | ----------- |
| `event`   | `str` | `"TeamParserModelResponseCompleted"` | Event type  |

### OutputModelResponseStartedEvent

| Attribute | Type  | Default                            | Description |
| --------- | ----- | ---------------------------------- | ----------- |
| `event`   | `str` | `"TeamOutputModelResponseStarted"` | Event type  |

### OutputModelResponseCompletedEvent

| Attribute | Type  | Default                              | Description |
| --------- | ----- | ------------------------------------ | ----------- |
| `event`   | `str` | `"TeamOutputModelResponseCompleted"` | Event type  |

### ModelRequestStartedEvent

| Attribute        | Type            | Default                     | Description      |
| ---------------- | --------------- | --------------------------- | ---------------- |
| `event`          | `str`           | `"TeamModelRequestStarted"` | Event type       |
| `model`          | `Optional[str]` | `None`                      | Model identifier |
| `model_provider` | `Optional[str]` | `None`                      | Model provider   |

### ModelRequestCompletedEvent

| Attribute             | Type              | Default                       | Description                    |
| --------------------- | ----------------- | ----------------------------- | ------------------------------ |
| `event`               | `str`             | `"TeamModelRequestCompleted"` | Event type                     |
| `model`               | `Optional[str]`   | `None`                        | Model identifier               |
| `model_provider`      | `Optional[str]`   | `None`                        | Model provider                 |
| `input_tokens`        | `Optional[int]`   | `None`                        | Input token count              |
| `output_tokens`       | `Optional[int]`   | `None`                        | Output token count             |
| `total_tokens`        | `Optional[int]`   | `None`                        | Total token count              |
| `time_to_first_token` | `Optional[float]` | `None`                        | Time to first token in seconds |
| `reasoning_tokens`    | `Optional[int]`   | `None`                        | Reasoning token count          |
| `cache_read_tokens`   | `Optional[int]`   | `None`                        | Cache read token count         |
| `cache_write_tokens`  | `Optional[int]`   | `None`                        | Cache write token count        |

### CompressionStartedEvent

| Attribute | Type  | Default                    | Description |
| --------- | ----- | -------------------------- | ----------- |
| `event`   | `str` | `"TeamCompressionStarted"` | Event type  |

### CompressionCompletedEvent

| Attribute                 | Type            | Default                      | Description                       |
| ------------------------- | --------------- | ---------------------------- | --------------------------------- |
| `event`                   | `str`           | `"TeamCompressionCompleted"` | Event type                        |
| `tool_results_compressed` | `Optional[int]` | `None`                       | Number of compressed tool results |
| `original_size`           | `Optional[int]` | `None`                       | Original size in bytes            |
| `compressed_size`         | `Optional[int]` | `None`                       | Compressed size in bytes          |

### CustomEvent

| Attribute | Type  | Default         | Description |
| --------- | ----- | --------------- | ----------- |
| `event`   | `str` | `"CustomEvent"` | Event type  |
