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

# Team

> Constructor parameters and methods for the Team class.

## Parameters

| Parameter | Type | Default | Description |
| - | - | - | - |
| `members` | `Union[List[Union[Agent, Team]], Callable[..., List]]` | - | List of agents or teams that make up this team, or a callable factory that returns the list |
| `id` | `Optional[str]` | `None` | Team UUID (autogenerated if not set) |
| `model` | `Optional[Union[Model, str]]` | `None` | Model to use for the team. Can be a Model object or a model string (`provider:model_id`) |
| `fallback_models` | `Optional[List[Union[Model, str]]]` | `None` | Models tried in order when the primary model fails. Ignored if `fallback_config` is set |
| `fallback_config` | `Optional[FallbackConfig]` | `None` | Fallback configuration for model failures, with support for error-specific routing. Takes precedence over `fallback_models` |
| `name` | `Optional[str]` | `None` | Name of the team |
| `role` | `Optional[str]` | `None` | Role of the team within its parent team |
| `mode` | `Optional[TeamMode]` | `None` | Team coordination mode (`coordinate`, `route`, `broadcast`, `tasks`). When set, overrides delegation flags to match the mode |
| `respond_directly` | `bool` | `False` | If True, the team leader won't process responses from the members and instead will return them directly. If `delegate_to_all_members=True` is also set, this is silently disabled with a warning |
| `determine_input_for_members` | `bool` | `True` | Set to False if you want to send the run input directly to the member agents |
| `delegate_to_all_members` | `bool` | `False` | If True, the team leader will delegate tasks to all members automatically, without any decision from the team leader. Takes precedence over `respond_directly=True` |
| `max_iterations` | `int` | `10` | Maximum number of task-loop iterations when `mode=TeamMode.tasks` |
| `user_id` | `Optional[str]` | `None` | Default user ID for this team |
| `session_id` | `Optional[str]` | `None` | Default session ID for this team (autogenerated if not set) |
| `session_state` | `Optional[Dict[str, Any]]` | `None` | Session state (stored in the database to persist across runs) |
| `add_session_state_to_context` | `bool` | `False` | Set to True to add the session\_state to the context |
| `enable_agentic_state` | `bool` | `False` | Set to True to give the team tools to update the session\_state dynamically |
| `overwrite_db_session_state` | `bool` | `False` | Set to True to overwrite the session state in the database with the session state provided in the run |
| `cache_session` | `bool` | `False` | If True, cache the current Team session in memory for faster access |
| `resolve_in_context` | `bool` | `True` | If True, resolve the session\_state, dependencies, and metadata in the user and system messages |
| `description` | `Optional[str]` | `None` | A description of the Team that is added to the start of the system message |
| `instructions` | `Optional[Union[str, List[str], Callable]]` | `None` | List of instructions for the team |
| `use_instruction_tags` | `bool` | `False` | If True, wrap instructions in `<instructions>` tags |
| `expected_output` | `Optional[str]` | `None` | Provide the expected output from the Team |
| `additional_context` | `Optional[str]` | `None` | Additional context added to the end of the system message |
| `markdown` | `bool` | `False` | If markdown=true, add instructions to format the output using markdown |
| `add_datetime_to_context` | `bool` | `False` | If True, add the current datetime to the instructions to give the team a sense of time |
| `add_location_to_context` | `bool` | `False` | If True, add the current location to the instructions to give the team a sense of location |
| `datetime_format` | `Optional[str]` | `None` | Custom format string for the datetime added to context (e.g. `"%Y-%m-%d %H:%M:%S"`). If None, the default datetime string representation is used |
| `timezone_identifier` | `Optional[str]` | `None` | Allows for custom timezone for datetime instructions following the TZ Database format |
| `add_name_to_context` | `bool` | `False` | If True, add the team name to the instructions |
| `add_member_tools_to_context` | `bool` | `False` | If True, add the tools available to team members to the context |
| `system_message` | `Optional[Union[str, Callable, Message]]` | `None` | Provide the system message as a string or function |
| `system_message_role` | `str` | `"system"` | Role for the system message |
| `introduction` | `Optional[str]` | `None` | Introduction message for the Team |
| `additional_input` | `Optional[List[Union[str, Dict, BaseModel, Message]]]` | `None` | A list of extra messages added after the system message and before the user message |
| `db` | `Optional[Union[BaseDb, AsyncBaseDb]]` | `None` | Database to use for this team |
| `checkpoint` | `Optional[Literal["runs", "tool-batch", "tools"]]` | `None` | When to persist run state to the database. `"runs"` writes only at terminal states; `"tool-batch"` also writes after each model turn. `None` falls back to the AgentOS-level setting, else `"runs"`. `"tools"` is reserved for 3.0 |
| `memory_manager` | `Optional[MemoryManager]` | `None` | Memory manager to use for this team |
| `dependencies` | `Optional[Dict[str, Any]]` | `None` | User provided dependencies |
| `add_dependencies_to_context` | `bool` | `False` | If True, add the dependencies to the user prompt |
| `knowledge` | `Optional[Union[KnowledgeProtocol, Callable[..., KnowledgeProtocol]]]` | `None` | Add a knowledge base to the team |
| `knowledge_filters` | `Optional[Union[Dict[str, Any], List[FilterExpr]]]` | `None` | Filters to apply to knowledge base searches |
| `enable_agentic_knowledge_filters` | `Optional[bool]` | `False` | Let the team choose the knowledge filters |
| `update_knowledge` | `bool` | `False` | Add a tool that allows the Team to update Knowledge |
| `add_knowledge_to_context` | `bool` | `False` | If True, add references to the user prompt |
| `knowledge_retriever` | `Optional[Callable[..., Optional[List[Union[Dict, str]]]]]` | `None` | Retrieval function to get references |
| `references_format` | `Literal["json", "yaml"]` | `"json"` | Format of the references |
| `skills` | `Optional[Skills]` | `None` | Skills for this team. Loads structured instructions, reference docs, and scripts, and gives the team tools to access them |
| `share_member_interactions` | `bool` | `False` | If True, send all member interactions (request/response) during the current run to members that have been delegated a task to |
| `get_member_information_tool` | `bool` | `False` | If True, add a tool to get information about the team members |
| `search_knowledge` | `bool` | `True` | Add a tool to search the knowledge base (aka Agentic RAG) |
| `add_search_knowledge_instructions` | `bool` | `True` | If True, add search\_knowledge instructions to the system prompt |
| `send_media_to_model` | `bool` | `True` | If False, media (images, videos, audio, files) is only available to tools and not sent to the LLM |
| `store_media` | `bool` | `True` | If True, store media in the database |
| `media_storage` | `Optional[Union[MediaStorage, AsyncMediaStorage]]` | `None` | Offload media to external storage and keep only a reference in the database |
| `store_tool_messages` | `bool` | `True` | If True, store tool results in the database |
| `store_history_messages` | `bool` | `False` | If True, store history messages in the database |
| `tools` | `Optional[Union[List[Union[Toolkit, Callable, Function, Dict]], Callable[..., List]]]` | `None` | A list of tools provided to the Model, or a callable factory that returns the list |
| `tool_choice` | `Optional[Union[str, Dict[str, Any]]]` | `None` | Controls which (if any) tool is called by the team model |
| `tool_call_limit` | `Optional[int]` | `None` | Maximum number of tool calls allowed |
| `max_tool_calls_from_history` | `Optional[int]` | `None` | Maximum number of tool calls from history to keep in context. If None, all tool calls from history are included. If set to N, only the last N tool calls from history are added to the context for memory management |
| `tool_hooks` | `Optional[List[Callable]]` | `None` | A list of hooks to be called before and after the tool call |
| `pre_hooks` | `Optional[List[Union[Callable[..., Any], BaseGuardrail, BaseEval]]]` | `None` | Functions called right after team session is loaded, before processing starts |
| `post_hooks` | `Optional[List[Union[Callable[..., Any], BaseGuardrail, BaseEval]]]` | `None` | Functions called after output is generated but before the response is returned |
| `input_schema` | `Optional[Type[BaseModel]]` | `None` | Input schema for validating input |
| `output_schema` | `Optional[Union[Type[BaseModel], Dict[str, Any]]]` | `None` | Output schema for the team response. Can be a Pydantic model or a JSON schema |
| `parser_model` | `Optional[Union[Model, str]]` | `None` | Provide a secondary model to parse the response from the primary model. Can be a Model object or a model string (`provider:model_id`) |
| `parser_model_prompt` | `Optional[str]` | `None` | Provide a prompt for the parser model |
| `output_model` | `Optional[Union[Model, str]]` | `None` | Provide an output model to parse the response from the team. Can be a Model object or a model string (`provider:model_id`) |
| `output_model_prompt` | `Optional[str]` | `None` | Provide a prompt for the output model |
| `use_json_mode` | `bool` | `False` | If `output_schema` is set, sets the response mode of the model |
| `parse_response` | `bool` | `True` | If True, parse the response |
| `enable_agentic_memory` | `bool` | `False` | Enable the team to manage memories of the user |
| `update_memory_on_run` | `bool` | `False` | If True, the team creates/updates user memories at the end of runs |
| `add_memories_to_context` | `Optional[bool]` | `None` | If True, the team adds a reference to the user memories in the response |
| `enable_session_summaries` | `bool` | `False` | If True, the team creates/updates session summaries at the end of runs |
| `session_summary_manager` | `Optional[SessionSummaryManager]` | `None` | Session summary manager |
| `add_session_summary_to_context` | `Optional[bool]` | `None` | If True, the team adds session summaries to the context |
| `learning` | `Optional[Union[bool, LearningMachine]]` | `None` | LearningMachine for unified learning capabilities |
| `add_learnings_to_context` | `bool` | `True` | Add learnings context to system prompt |
| `compress_tool_results` | `bool` | `False` | If True, compress tool call results to save context space |
| `compression_manager` | `Optional[CompressionManager]` | `None` | Custom compression manager for compressing tool call results |
| `offload_tool_results` | `Optional[Union[bool, ResultStore]]` | `None` | Offload long tool results and member answers. `True` uses the defaults, a `ResultStore` customizes them, `None` allows parent-team inheritance, and `False` disables inherited offloading. |
| `add_history_to_context` | `bool` | `False` | Add messages from the chat history to the messages list sent to the Model. This only applies to the team leader, not the members. |
| `num_history_runs` | `Optional[int]` | `None` | Number of historical runs to include in the messages. |
| `num_history_messages` | `Optional[int]` | `None` | Number of historical messages to include messages list sent to the Model. |
| `add_team_history_to_members` | `bool` | `False` | If True, send the team-level history to the members, not the agent-level history |
| `num_team_history_runs` | `int` | `3` | Number of historical runs to include in the messages sent to the members |
| `search_past_sessions` | `Optional[bool]` | `False` | Add tools that let the team search past sessions and read their full conversations |
| `num_past_sessions_to_search` | `Optional[int]` | `None` | Maximum number of past sessions returned by the `search_past_sessions` tool. Defaults to 20 when unset |
| `num_past_session_runs_in_search` | `Optional[int]` | `None` | Number of runs included in each session preview returned by the `search_past_sessions` tool. Defaults to 3 when unset |
| `read_chat_history` | `bool` | `False` | If True, adds a tool to allow the team to read the chat history |
| `metadata` | `Optional[Dict[str, Any]]` | `None` | Metadata stored with this team |
| `reasoning_model` | `Optional[Union[Model, str]]` | `None` | Model to use for reasoning. Can be a Model object or a model string (`provider:model_id`) |
| `reasoning_agent` | `Optional[Agent]` | `None` | Agent to use for reasoning |
| `followups` | `bool` | `False` | If True, generate followup prompt suggestions after the main response and set them on the run output |
| `num_followups` | `int` | `3` | Number of followup prompts to generate |
| `followup_model` | `Optional[Union[Model, str]]` | `None` | Model used to generate followups. Defaults to the team's model |
| `stream` | `Optional[bool]` | `None` | Stream the response from the Team |
| `stream_events` | `Optional[bool]` | `None` | Stream the intermediate steps from the Team |
| `stream_member_events` | `bool` | `True` | Stream the member events from the Team members |
| `store_events` | `bool` | `False` | Store the events from the Team |
| `events_to_skip` | `Optional[List[Union[RunEvent, TeamRunEvent]]]` | `None` | List of events to skip from the Team |
| `store_member_responses` | `bool` | `False` | Store member agent runs inside the team's RunOutput |
| `debug_mode` | `bool` | `False` | Enable debug logs |
| `debug_level` | `Literal[1, 2]` | `1` | Debug level: 1 = basic, 2 = detailed |
| `show_members_responses` | `bool` | `False` | Enable member logs - Sets the debug\_mode for team and members |
| `retries` | `int` | `0` | Number of retries to attempt when running the Team |
| `delay_between_retries` | `int` | `1` | Delay between retries (in seconds) |
| `exponential_backoff` | `bool` | `False` | Exponential backoff: if True, the delay between retries is doubled each time |
| `telemetry` | `bool` | `True` | Log minimal telemetry for analytics |
| `cache_callables` | `bool` | `True` | Cache callable factory results by key. Key resolution uses custom key, then `user_id`, then `session_id` |
| `callable_tools_cache_key` | `Optional[Callable[..., Optional[str]]]` | `None` | Custom cache key function for tools callable factory. Overrides default key resolution |
| `callable_knowledge_cache_key` | `Optional[Callable[..., Optional[str]]]` | `None` | Custom cache key function for knowledge callable factory. Overrides default key resolution |
| `callable_members_cache_key` | `Optional[Callable[..., Optional[str]]]` | `None` | Custom cache key function for members callable factory. Overrides default key resolution |

## Functions

### `run`

Run the team.

**Parameters:**

* `input` (Union\[str, List, Dict, Message, BaseModel, List\[Message]]): The input to send to the team
* `stream` (Optional\[bool]): Whether to stream the response
* `stream_events` (Optional\[bool]): Whether to stream intermediate steps
* `session_id` (Optional\[str]): Session ID to use
* `session_state` (Optional\[Dict\[str, Any]]): Session state to use. By default, merged with the session state in the db.
* `run_context` (Optional\[RunContext]): Run context to use
* `run_id` (Optional\[str]): Run ID to use
* `user_id` (Optional\[str]): User ID to use
* `audio` (Optional\[Sequence\[Audio]]): Audio files to include
* `images` (Optional\[Sequence\[Image]]): Image files to include
* `videos` (Optional\[Sequence\[Video]]): Video files to include
* `files` (Optional\[Sequence\[File]]): Files to include
* `knowledge_filters` (Optional\[Union\[Dict\[str, Any], List\[FilterExpr]]]): Knowledge filters to apply
* `add_history_to_context` (Optional\[bool]): Whether to add history to context
* `add_dependencies_to_context` (Optional\[bool]): Whether to add dependencies to context
* `add_session_state_to_context` (Optional\[bool]): Whether to add session state to context
* `dependencies` (Optional\[Dict\[str, Any]]): Dependencies to use for this run
* `metadata` (Optional\[Dict\[str, Any]]): Metadata to use for this run
* `output_schema` (Optional\[Union\[Type\[BaseModel], Dict\[str, Any]]]): Output schema to use for this run. Can be a Pydantic model or a JSON schema.
* `debug_mode` (Optional\[bool]): Whether to enable debug mode
* `yield_run_output` (bool): Whether to yield the run output (only for streaming)

**Returns:**

* `Union[TeamRunOutput, Iterator[Union[RunOutputEvent, TeamRunOutputEvent]]]`: Either a TeamRunOutput or an iterator of events, depending on the `stream` parameter

### `arun`

Run the team asynchronously.

**Parameters:**

* `input` (Union\[str, List, Dict, Message, BaseModel, List\[Message]]): The input to send to the team
* `stream` (Optional\[bool]): Whether to stream the response
* `stream_events` (Optional\[bool]): Whether to stream intermediate steps
* `session_id` (Optional\[str]): Session ID to use
* `session_state` (Optional\[Dict\[str, Any]]): Session state to use. By default, merged with the session state in the db.
* `run_id` (Optional\[str]): Run ID to use
* `run_context` (Optional\[RunContext]): Run context to use
* `user_id` (Optional\[str]): User ID to use
* `audio` (Optional\[Sequence\[Audio]]): Audio files to include
* `images` (Optional\[Sequence\[Image]]): Image files to include
* `videos` (Optional\[Sequence\[Video]]): Video files to include
* `files` (Optional\[Sequence\[File]]): Files to include
* `knowledge_filters` (Optional\[Union\[Dict\[str, Any], List\[FilterExpr]]]): Knowledge filters to apply
* `add_history_to_context` (Optional\[bool]): Whether to add history to context
* `add_dependencies_to_context` (Optional\[bool]): Whether to add dependencies to context
* `add_session_state_to_context` (Optional\[bool]): Whether to add session state to context
* `dependencies` (Optional\[Dict\[str, Any]]): Dependencies to use for this run
* `metadata` (Optional\[Dict\[str, Any]]): Metadata to use for this run
* `output_schema` (Optional\[Union\[Type\[BaseModel], Dict\[str, Any]]]): Output schema to use for this run. Can be a Pydantic model or a JSON schema.
* `debug_mode` (Optional\[bool]): Whether to enable debug mode
* `yield_run_output` (bool): Whether to yield the run output (only for streaming)
* `background` (bool): Whether to run the team in background mode. Requires `stream=False` and a configured database.

**Returns:**

* `Union[TeamRunOutput, AsyncIterator[Union[RunOutputEvent, TeamRunOutputEvent]]]`: Either a TeamRunOutput or an async iterator of events, depending on the `stream` parameter

### `continue_run`

Continue a run.

**Parameters:**

* `run_response` (Optional\[TeamRunOutput]): The run response to continue
* `run_id` (Optional\[str]): The run ID to continue
* `requirements` (Optional\[List\[Any]]): Updated run requirements to resolve, e.g. tool approvals
* `input` (Optional\[str]): Additional input to send when continuing the run
* `continue_from` (Union\[int, Literal\["end", "last\_user"]]): Where to resume the run from. Defaults to `"end"`
* `fork` (bool): If True, continue into a new forked run instead of updating the original
* `regenerate` (bool): If True, regenerate the run instead of continuing it
* `replace_original` (Optional\[bool]): Whether the new run replaces the original run in the session
* `additional_instructions` (Optional\[str]): Extra instructions added for the continued run
* `stream` (Optional\[bool]): Whether to stream the response
* `stream_events` (Optional\[bool]): Whether to stream intermediate steps
* `user_id` (Optional\[str]): User ID to use
* `session_id` (Optional\[str]): Session ID to use
* `run_context` (Optional\[RunContext]): Run context to use
* `knowledge_filters` (Optional\[Union\[Dict\[str, Any], List\[FilterExpr]]]): Knowledge filters to apply
* `dependencies` (Optional\[Dict\[str, Any]]): Dependencies to use for this run
* `metadata` (Optional\[Dict\[str, Any]]): Metadata to use for this run
* `debug_mode` (Optional\[bool]): Whether to enable debug mode
* `yield_run_output` (bool): Whether to yield the run output (only for streaming)

**Returns:**

* `Union[TeamRunOutput, Iterator[Union[TeamRunOutputEvent, RunOutputEvent, TeamRunOutput]]]`: Either a TeamRunOutput or an iterator of events, depending on the `stream` parameter

### `acontinue_run`

Continue a run asynchronously.

**Parameters:**

* `run_response` (Optional\[TeamRunOutput]): The run response to continue
* `run_id` (Optional\[str]): The run ID to continue
* `requirements` (Optional\[List\[Any]]): Updated run requirements to resolve, e.g. tool approvals
* `input` (Optional\[str]): Additional input to send when continuing the run
* `continue_from` (Union\[int, Literal\["end", "last\_user"]]): Where to resume the run from. Defaults to `"end"`
* `fork` (bool): If True, continue into a new forked run instead of updating the original
* `regenerate` (bool): If True, regenerate the run instead of continuing it
* `replace_original` (Optional\[bool]): Whether the new run replaces the original run in the session
* `additional_instructions` (Optional\[str]): Extra instructions added for the continued run
* `stream` (Optional\[bool]): Whether to stream the response
* `stream_events` (Optional\[bool]): Whether to stream intermediate steps
* `user_id` (Optional\[str]): User ID to use
* `session_id` (Optional\[str]): Session ID to use
* `run_context` (Optional\[RunContext]): Run context to use
* `knowledge_filters` (Optional\[Union\[Dict\[str, Any], List\[FilterExpr]]]): Knowledge filters to apply
* `dependencies` (Optional\[Dict\[str, Any]]): Dependencies to use for this run
* `metadata` (Optional\[Dict\[str, Any]]): Metadata to use for this run
* `debug_mode` (Optional\[bool]): Whether to enable debug mode
* `yield_run_output` (bool): Whether to yield the run output (only for streaming)
* `background` (bool): Whether to continue the run in background mode

**Returns:**

* `Union[TeamRunOutput, AsyncIterator[Union[TeamRunOutputEvent, RunOutputEvent, TeamRunOutput]]]`: Either a TeamRunOutput or an async iterator of events, depending on the `stream` parameter

### `print_response`

Run the team and print the response.

**Parameters:**

* `input` (Union\[List, Dict, str, Message, BaseModel, List\[Message]]): The input to send to the team
* `stream` (Optional\[bool]): Whether to stream the response
* `session_id` (Optional\[str]): Session ID to use
* `session_state` (Optional\[Dict\[str, Any]]): Session state to use. By default, merged with the session state in the db.
* `user_id` (Optional\[str]): User ID to use
* `run_id` (Optional\[str]): Run ID to use
* `show_message` (bool): Whether to show the message (default: True)
* `show_reasoning` (bool): Whether to show reasoning (default: True)
* `show_full_reasoning` (bool): Whether to show full reasoning (default: False)
* `console` (Optional\[Any]): Console to use for output
* `tags_to_include_in_markdown` (Optional\[Set\[str]]): Tags to include in markdown content
* `audio` (Optional\[Sequence\[Audio]]): Audio files to include
* `images` (Optional\[Sequence\[Image]]): Image files to include
* `videos` (Optional\[Sequence\[Video]]): Video files to include
* `files` (Optional\[Sequence\[File]]): Files to include
* `markdown` (Optional\[bool]): Whether to format output as markdown
* `knowledge_filters` (Optional\[Union\[Dict\[str, Any], List\[FilterExpr]]]): Knowledge filters to apply
* `add_history_to_context` (Optional\[bool]): Whether to add history to context
* `dependencies` (Optional\[Dict\[str, Any]]): Dependencies to use for this run
* `add_dependencies_to_context` (Optional\[bool]): Whether to add dependencies to context
* `add_session_state_to_context` (Optional\[bool]): Whether to add session state to context
* `metadata` (Optional\[Dict\[str, Any]]): Metadata to use for this run
* `debug_mode` (Optional\[bool]): Whether to enable debug mode
* `show_member_responses` (Optional\[bool]): Whether to show member responses

### `aprint_response`

Run the team and print the response asynchronously.

**Parameters:**

* `input` (Union\[List, Dict, str, Message, BaseModel, List\[Message]]): The input to send to the team
* `stream` (Optional\[bool]): Whether to stream the response
* `session_id` (Optional\[str]): Session ID to use
* `session_state` (Optional\[Dict\[str, Any]]): Session state to use. By default, merged with the session state in the db.
* `user_id` (Optional\[str]): User ID to use
* `run_id` (Optional\[str]): Run ID to use
* `show_message` (bool): Whether to show the message (default: True)
* `show_reasoning` (bool): Whether to show reasoning (default: True)
* `show_full_reasoning` (bool): Whether to show full reasoning (default: False)
* `console` (Optional\[Any]): Console to use for output
* `tags_to_include_in_markdown` (Optional\[Set\[str]]): Tags to include in markdown content
* `audio` (Optional\[Sequence\[Audio]]): Audio files to include
* `images` (Optional\[Sequence\[Image]]): Image files to include
* `videos` (Optional\[Sequence\[Video]]): Video files to include
* `files` (Optional\[Sequence\[File]]): Files to include
* `markdown` (Optional\[bool]): Whether to format output as markdown
* `knowledge_filters` (Optional\[Union\[Dict\[str, Any], List\[FilterExpr]]]): Knowledge filters to apply
* `add_history_to_context` (Optional\[bool]): Whether to add history to context
* `dependencies` (Optional\[Dict\[str, Any]]): Dependencies to use for this run
* `add_dependencies_to_context` (Optional\[bool]): Whether to add dependencies to context
* `add_session_state_to_context` (Optional\[bool]): Whether to add session state to context
* `metadata` (Optional\[Dict\[str, Any]]): Metadata to use for this run
* `debug_mode` (Optional\[bool]): Whether to enable debug mode
* `show_member_responses` (Optional\[bool]): Whether to show member responses

### `cli_app`

Run an interactive command-line interface to interact with the team.

**Parameters:**

* `input` (Optional\[str]): The input to send to the team
* `user` (str): Name for the user (default: "User")
* `emoji` (str): Emoji for the user (default: ":sunglasses:")
* `stream` (bool): Whether to stream the response (default: False)
* `markdown` (bool): Whether to format output as markdown (default: False)
* `exit_on` (Optional\[List\[str]]): List of commands to exit the CLI
* `**kwargs`: Additional keyword arguments

### `acli_app`

Run an interactive command-line interface to interact with the team asynchronously.

**Parameters:**

* `input` (Optional\[str]): The input to send to the team
* `session_id` (Optional\[str]): Session ID to use
* `user_id` (Optional\[str]): User ID to use
* `user` (str): Name for the user (default: "User")
* `emoji` (str): Emoji for the user (default: ":sunglasses:")
* `stream` (bool): Whether to stream the response (default: False)
* `markdown` (bool): Whether to format output as markdown (default: False)
* `exit_on` (Optional\[List\[str]]): List of commands to exit the CLI
* `**kwargs`: Additional keyword arguments

### `get_session_summary`

Get the session summary for the given session ID.

**Parameters:**

* `session_id` (Optional\[str]): Session ID to use (if not provided, the current session is used)

**Returns:**

* `Optional[SessionSummary]`: The session summary

### `get_user_memories`

Get the user memories for the given user ID.

**Parameters:**

* `user_id` (Optional\[str]): User ID to use (if not provided, the current user is used)

**Returns:**

* `Optional[List[UserMemory]]`: The user memories

### `add_tool`

Add a tool to the team.

**Parameters:**

* `tool` (Union\[Toolkit, Callable, Function, Dict]): The tool to add

### `set_tools`

Replace the tools of the team.

**Parameters:**

* `tools` (Union\[List\[Union\[Toolkit, Callable, Function, Dict]], Callable\[..., List]]): The tools to set, or a callable factory that returns the list

### `cancel_run`

Cancel a run by run ID.

**Parameters:**

* `run_id` (str): The run ID to cancel

**Returns:**

* `bool`: True if the run was successfully cancelled

### `get_run_output`

Get the run output for the given run ID.

**Parameters:**

* `run_id` (str): The run ID
* `session_id` (Optional\[str]): Session ID to use
* `user_id` (Optional\[str]): User ID to use

**Returns:**

* `Optional[Union[TeamRunOutput, RunOutput]]`: The run output

### `get_last_run_output`

Get the last run output for the session.

**Parameters:**

* `session_id` (Optional\[str]): Session ID to use (if not provided, the current session is used)

**Returns:**

* `Optional[TeamRunOutput]`: The last run output

### `get_session`

Get the session for the given session ID.

**Parameters:**

* `session_id` (Optional\[str]): Session ID to use (if not provided, the current session is used)
* `user_id` (Optional\[str]): User ID to use

**Returns:**

* `Optional[TeamSession]`: The team session

### `save_session`

Save a session to the database.

**Parameters:**

* `session` (TeamSession): The session to save

### `asave_session`

Save a session to the database asynchronously.

**Parameters:**

* `session` (TeamSession): The session to save

### `delete_session`

Delete a session.

**Parameters:**

* `session_id` (str): Session ID to delete
* `user_id` (Optional\[str]): User ID to use
* `delete_media` (bool): If True, also delete the session's offloaded media from `media_storage`. Defaults to False

### `get_session_name`

Get the session name for the given session ID.

**Parameters:**

* `session_id` (Optional\[str]): Session ID to use (if not provided, the current session is used)

**Returns:**

* `str`: The session name

### `set_session_name`

Set the session name.

**Parameters:**

* `session_id` (Optional\[str]): Session ID to use (if not provided, the current session is used)
* `autogenerate` (bool): Whether to autogenerate the name
* `session_name` (Optional\[str]): The name to set

**Returns:**

* `TeamSession`: The updated session

### `get_session_state`

Get the session state for the given session ID.

**Parameters:**

* `session_id` (Optional\[str]): Session ID to use (if not provided, the current session is used)

**Returns:**

* `Dict[str, Any]`: The session state

### `update_session_state`

Update the session state for the given session ID.

**Parameters:**

* `session_state_updates` (Dict\[str, Any]): The session state keys and values to update. Provided keys are merged into the existing session state, overwriting existing values
* `session_id` (Optional\[str]): Session ID to use (if not provided, the current session is used)

**Returns:**

* `Dict[str, Any]`: The updated session state

### `get_session_metrics`

Get the session metrics for the given session ID.

**Parameters:**

* `session_id` (Optional\[str]): Session ID to use (if not provided, the current session is used)

**Returns:**

* `Optional[SessionMetrics]`: The session metrics

### `get_chat_history`

Get the chat history for the given session ID.

**Parameters:**

* `session_id` (Optional\[str]): Session ID to use (if not provided, the current session is used)
* `last_n_runs` (Optional\[int]): The number of runs to return messages from, counting from the latest. Defaults to all runs

**Returns:**

* `List[Message]`: The chat history

### `get_session_messages`

Get the messages for the given session ID.

**Parameters:**

* `session_id` (Optional\[str]): Session ID to use (if not provided, the current session is used)
* `member_ids` (Optional\[List\[str]]): The ids of the members to get the messages from
* `last_n_runs` (Optional\[int]): The number of runs to return messages from, counting from the latest. Defaults to all runs
* `limit` (Optional\[int]): The number of messages to return, counting from the latest. Defaults to all messages
* `skip_roles` (Optional\[List\[str]]): Skip messages with these roles
* `skip_statuses` (Optional\[List\[RunStatus]]): Skip messages with these statuses
* `skip_history_messages` (bool): Skip messages that were tagged as history in previous runs. Defaults to True
* `skip_member_messages` (bool): Skip messages created by members of the team. Defaults to True

**Returns:**

* `List[Message]`: The messages for the session


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.