Parameters

ParameterTypeDefaultDescription
membersList[Union[Agent, Team]]-List of agents or teams that make up this team
idOptional[str]NoneTeam UUID (autogenerated if not set)
modelOptional[Model]NoneModel to use for the team
nameOptional[str]NoneName of the team
roleOptional[str]NoneRole of the team within its parent team
respond_directlyboolFalseIf True, the team leader won’t process responses from the members and instead will return them directly
determine_input_for_membersboolTrueSet to False if you want to send the run input directly to the member agents
delegate_task_to_all_membersboolFalseIf True, the team leader will delegate tasks to all members automatically, without any decision from the team leader
user_idOptional[str]NoneDefault user ID for this team
session_idOptional[str]NoneDefault session ID for this team (autogenerated if not set)
session_stateOptional[Dict[str, Any]]NoneSession state (stored in the database to persist across runs)
add_session_state_to_contextboolFalseSet to True to add the session_state to the context
enable_agentic_stateboolFalseSet to True to give the team tools to update the session_state dynamically
cache_sessionboolFalseIf True, cache the current Team session in memory for faster access
resolve_in_contextboolTrueIf True, resolve the session_state, dependencies, and metadata in the user and system messages
descriptionOptional[str]NoneA description of the Team that is added to the start of the system message
instructionsOptional[Union[str, List[str], Callable]]NoneList of instructions for the team
expected_outputOptional[str]NoneProvide the expected output from the Team
additional_contextOptional[str]NoneAdditional context added to the end of the system message
markdownboolFalseIf markdown=true, add instructions to format the output using markdown
add_datetime_to_contextboolFalseIf True, add the current datetime to the instructions to give the team a sense of time
add_location_to_contextboolFalseIf True, add the current location to the instructions to give the team a sense of location
timezone_identifierOptional[str]NoneAllows for custom timezone for datetime instructions following the TZ Database format
add_name_to_contextboolFalseIf True, add the team name to the instructions
add_member_tools_to_contextboolTrueIf True, add the tools available to team members to the context
system_messageOptional[Union[str, Callable, Message]]NoneProvide the system message as a string or function
system_message_rolestr"system"Role for the system message
additional_inputOptional[List[Union[str, Dict, BaseModel, Message]]]NoneA list of extra messages added after the system message and before the user message
dbOptional[BaseDb]NoneDatabase to use for this team
memory_managerOptional[MemoryManager]NoneMemory manager to use for this team
dependenciesOptional[Dict[str, Any]]NoneUser provided dependencies
add_dependencies_to_contextboolFalseIf True, add the dependencies to the user prompt
knowledgeOptional[Knowledge]NoneAdd a knowledge base to the team
knowledge_filtersOptional[Dict[str, Any]]NoneFilters to apply to knowledge base searches
enable_agentic_knowledge_filtersOptional[bool]FalseLet the team choose the knowledge filters
update_knowledgeboolFalseAdd a tool that allows the Team to update Knowledge
add_knowledge_to_contextboolFalseIf True, add references to the user prompt
knowledge_retrieverOptional[Callable[..., Optional[List[Union[Dict, str]]]]]NoneRetrieval function to get references
references_formatLiteral["json", "yaml"]"json"Format of the references
share_member_interactionsboolFalseIf True, send all previous member interactions to members
get_member_information_toolboolFalseIf True, add a tool to get information about the team members
search_knowledgeboolTrueAdd a tool to search the knowledge base (aka Agentic RAG)
read_team_historyboolFalseIf True, read the team history
send_media_to_modelboolTrueIf False, media (images, videos, audio, files) is only available to tools and not sent to the LLM
store_mediaboolTrueIf True, store media in run output
toolsOptional[List[Union[Toolkit, Callable, Function, Dict]]]NoneA list of tools provided to the Model
tool_choiceOptional[Union[str, Dict[str, Any]]]NoneControls which (if any) tool is called by the team model
tool_call_limitOptional[int]NoneMaximum number of tool calls allowed
tool_hooksOptional[List[Callable]]NoneA list of hooks to be called before and after the tool call
input_schemaOptional[Type[BaseModel]]NoneInput schema for validating input
output_schemaOptional[Type[BaseModel]]NoneOutput schema for the team response
parser_modelOptional[Model]NoneProvide a secondary model to parse the response from the primary model
parser_model_promptOptional[str]NoneProvide a prompt for the parser model
output_modelOptional[Model]NoneProvide an output model to parse the response from the team
output_model_promptOptional[str]NoneProvide a prompt for the output model
use_json_modeboolFalseIf output_schema is set, sets the response mode of the model
parse_responseboolTrueIf True, parse the response
enable_agentic_memoryboolFalseEnable the team to manage memories of the user
enable_user_memoriesboolFalseIf True, the team creates/updates user memories at the end of runs
add_memories_to_contextOptional[bool]NoneIf True, the team adds a reference to the user memories in the response
enable_session_summariesboolFalseIf True, the team creates/updates session summaries at the end of runs
session_summary_managerOptional[SessionSummaryManager]NoneSession summary manager
add_session_summary_to_contextOptional[bool]NoneIf True, the team adds session summaries to the context
add_history_to_contextboolFalseAdd messages from the chat history to the messages list sent to the Model
num_history_runsint3Number of historical runs to include in the messages
metadataOptional[Dict[str, Any]]NoneMetadata stored with this team
reasoningboolFalseEnable reasoning for the team
reasoning_modelOptional[Model]NoneModel to use for reasoning
reasoning_agentOptional[Agent]NoneAgent to use for reasoning
reasoning_min_stepsint1Minimum number of reasoning steps
reasoning_max_stepsint10Maximum number of reasoning steps
streamOptional[bool]NoneStream the response from the Team
stream_intermediate_stepsboolFalseStream the intermediate steps from the Team
stream_member_eventsboolTrueStream the member events from the Team members
store_eventsboolFalseStore the events from the Team
events_to_skipOptional[List[Union[RunEvent, TeamRunEvent]]]NoneList of events to skip from the Team
store_member_responsesboolFalseStore member agent runs inside the team’s RunOutput
debug_modeboolFalseEnable debug logs
debug_levelLiteral[1, 2]1Debug level: 1 = basic, 2 = detailed
show_members_responsesboolFalseEnable member logs - Sets the debug_mode for team and members
retriesint0Number of retries to attempt
delay_between_retriesint1Delay between retries (in seconds)
exponential_backoffboolFalseExponential backoff: if True, the delay between retries is doubled each time
telemetryboolTrueLog minimal telemetry for analytics

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_intermediate_steps (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
  • user_id (Optional[str]): User ID to use
  • retries (Optional[int]): Number of retries to attempt
  • 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[Dict[str, Any]]): 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
  • debug_mode (Optional[bool]): Whether to enable debug mode
  • yield_run_response (bool): Whether to yield the run response (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_intermediate_steps (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
  • user_id (Optional[str]): User ID to use
  • retries (Optional[int]): Number of retries to attempt
  • 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[Dict[str, Any]]): 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
  • debug_mode (Optional[bool]): Whether to enable debug mode
  • yield_run_response (bool): Whether to yield the run response (only for streaming)
Returns:
  • Union[TeamRunOutput, AsyncIterator[Union[RunOutputEvent, TeamRunOutputEvent]]]: Either a TeamRunOutput or an async iterator of events, depending on the stream parameter
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
  • stream_intermediate_steps (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
  • user_id (Optional[str]): User 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[Dict[str, Any]]): 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
  • metadata (Optional[Dict[str, Any]]): Metadata to use for this run
  • debug_mode (Optional[bool]): Whether to enable debug mode

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
  • stream_intermediate_steps (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
  • user_id (Optional[str]): User 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[Dict[str, Any]]): 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
  • metadata (Optional[Dict[str, Any]]): Metadata to use for this run
  • debug_mode (Optional[bool]): Whether to enable debug mode

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:
  • Session summary for the given session

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 (List[Union[Toolkit, Callable, Function, Dict]]): The tools to set

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
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)
Returns:
  • Optional[TeamSession]: The team session

save_session

Save a session to the database. Parameters:
  • session (TeamSession): The session to save

delete_session

Delete a session. Parameters:
  • session_id (str): Session ID to delete

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

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[Metrics]: 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)
Returns:
  • List[Message]: The chat history

get_messages_for_session

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)
Returns:
  • List[Message]: The messages for the session