Parameters
Functions
run
Execute the workflow synchronously with optional streaming.
Parameters:
input(Optional[Union[str, Dict[str, Any], List[Any], BaseModel]]): The input to send to the workflowadditional_data(Optional[Dict[str, Any]]): Additional data to include with the inputuser_id(Optional[str]): User ID to usesession_id(Optional[str]): Session ID to usesession_state(Optional[Dict[str, Any]]): Session state to useaudio(Optional[List[Audio]]): Audio files to includeimages(Optional[List[Image]]): Image files to includevideos(Optional[List[Video]]): Video files to includefiles(Optional[List[File]]): Files to includestream(bool): Whether to stream the responsestream_events(Optional[bool]): Whether to stream intermediate steps
Union[WorkflowRunOutput, Iterator[WorkflowRunOutputEvent]]: Either a WorkflowRunOutput or an iterator of WorkflowRunOutputEvents, depending on thestreamparameter
arun
Execute the workflow asynchronously with optional streaming.
Parameters:
input(Optional[Union[str, Dict[str, Any], List[Any], BaseModel, List[Message]]]): The input to send to the workflowadditional_data(Optional[Dict[str, Any]]): Additional data to include with the inputuser_id(Optional[str]): User ID to usesession_id(Optional[str]): Session ID to usesession_state(Optional[Dict[str, Any]]): Session state to useaudio(Optional[List[Audio]]): Audio files to includeimages(Optional[List[Image]]): Image files to includevideos(Optional[List[Video]]): Video files to includefiles(Optional[List[File]]): Files to includestream(bool): Whether to stream the responsestream_events(Optional[bool]): Whether to stream intermediate stepsbackground(Optional[bool]): Whether to run in backgroundwebsocket(Optional[WebSocket]): WebSocket for real-time communication
Union[WorkflowRunOutput, AsyncIterator[WorkflowRunOutputEvent]]: Either a WorkflowRunOutput or an iterator of WorkflowRunOutputEvents, depending on thestreamparameter
print_response
Print workflow execution with rich formatting and optional streaming.
Parameters:
input(Union[str, Dict[str, Any], List[Any], BaseModel, List[Message]]): The input to send to the workflowadditional_data(Optional[Dict[str, Any]]): Additional data to include with the inputuser_id(Optional[str]): User ID to usesession_id(Optional[str]): Session ID to useaudio(Optional[List[Audio]]): Audio files to includeimages(Optional[List[Image]]): Image files to includevideos(Optional[List[Video]]): Video files to includefiles(Optional[List[File]]): Files to includestream(Optional[bool]): Whether to stream the response contentmarkdown(bool): Whether to render content as markdownshow_time(bool): Whether to show execution timeshow_step_details(bool): Whether to show individual step outputsconsole(Optional[Any]): Rich console instance (optional)
aprint_response
Print workflow execution with rich formatting and optional streaming asynchronously.
Parameters:
input(Union[str, Dict[str, Any], List[Any], BaseModel, List[Message]]): The input to send to the workflowadditional_data(Optional[Dict[str, Any]]): Additional data to include with the inputuser_id(Optional[str]): User ID to usesession_id(Optional[str]): Session ID to useaudio(Optional[List[Audio]]): Audio files to includeimages(Optional[List[Image]]): Image files to includevideos(Optional[List[Video]]): Video files to includefiles(Optional[List[File]]): Files to includestream(Optional[bool]): Whether to stream the response contentmarkdown(bool): Whether to render content as markdownshow_time(bool): Whether to show execution timeshow_step_details(bool): Whether to show individual step outputsconsole(Optional[Any]): Rich console instance (optional)
cli_app
Run an interactive command-line interface to interact with the workflow.
Parameters:
input(Optional[str]): The input to send to the workflowsession_id(Optional[str]): Session ID to useuser_id(Optional[str]): User ID to useuser(str): Name for the user (default: “User”)emoji(str): Emoji for the user (default: “:technologist:”)stream(Optional[bool]): Whether to stream the response contentmarkdown(bool): Whether to render content as markdown (default: True)show_time(bool): Whether to show execution time (default: True)show_step_details(bool): Whether to show individual step outputs (default: True)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 workflow asynchronously.
Parameters:
input(Optional[str]): The input to send to the workflowsession_id(Optional[str]): Session ID to useuser_id(Optional[str]): User ID to useuser(str): Name for the user (default: “User”)emoji(str): Emoji for the user (default: “:technologist:”)stream(Optional[bool]): Whether to stream the response contentmarkdown(bool): Whether to render content as markdown (default: True)show_time(bool): Whether to show execution time (default: True)show_step_details(bool): Whether to show individual step outputs (default: True)exit_on(Optional[List[str]]): List of commands to exit the CLI**kwargs: Additional keyword arguments
cancel_run
Cancel a running workflow execution.
Parameters:
run_id(str): The run_id to cancel
bool: True if the run was found and marked for cancellation, False otherwise
get_run
Get the status and details of a background workflow run.
Parameters:
run_id(str): The run ID to get
Optional[WorkflowRunOutput]: The workflow run output if found
get_run_output
Get a WorkflowRunOutput from the database.
Parameters:
run_id(str): The run IDsession_id(Optional[str]): Session ID to use
Optional[WorkflowRunOutput]: The run output
get_last_run_output
Get the last run response from the database for the given session ID.
Parameters:
session_id(Optional[str]): Session ID to use
Optional[WorkflowRunOutput]: The last run output
get_chat_history
Return a list of dictionaries containing the input and output for each run in the session.
Parameters:
session_id(Optional[str]): The session ID to get the chat history for. If not provided, the current cached session ID is usedlast_n_runs(Optional[int]): Number of recent runs to include. If None, all runs will be considered
List[WorkflowChatInteraction]: A list of dictionaries containing the input and output for each run
get_session
Get the session for the given session ID.
Parameters:
session_id(Optional[str]): Session ID to use
Optional[WorkflowSession]: The workflow session
get_session_state
Get the session state for the given session ID.
Parameters:
session_id(Optional[str]): Session ID to use
Dict[str, Any]: The session state
get_session_name
Get the session name for the given session ID.
Parameters:
session_id(Optional[str]): Session ID to use
str: The session name
set_session_name
Set the session name and save to storage.
Parameters:
session_id(Optional[str]): Session ID to useautogenerate(bool): Whether to autogenerate the namesession_name(Optional[str]): The name to set
WorkflowSession: The updated session
get_session_metrics
Get the session metrics for the given session ID.
Parameters:
session_id(Optional[str]): Session ID to use
Optional[SessionMetrics]: The session metrics
delete_session
Delete a session.
Parameters:
session_id(str): Session ID to delete
save_session
Save the WorkflowSession to storage.
Parameters:
session(WorkflowSession): The session to save
to_dict
Convert workflow to dictionary representation.
Returns:
Dict[str, Any]: Dictionary representation of the workflow