The run() method returns a tuple of three values: (finish_params, history, metadata).
finish_params
Contains the agent's final response when it calls the finish tool. It includes:
reason: A string explanation of what was accomplished.paths: A list of file paths created or modified during execution.
history
A list of message groups (SystemMessage, UserMessage, AssistantMessage, ToolMessage).
AssistantMessage objects use a blocks list to preserve the model's emission order (e.g., reasoning $\rightarrow$ text $\rightarrow$ tool call). Block types include text, reasoning, tool_call, and various media kinds.
Note: Accessing deprecated attributes like .content or .tool_calls on an AssistantMessage will emit a DeprecationWarning. Use convenience accessors like joined_text, final_text, tool_call_blocks, or reasoning_blocks instead.
metadata
A dictionary containing metadata from tool executions and token usage. You can use aggregate_metadata to combine metadata across all tool calls.
# Example of unpacking run results
finish_params, history, metadata = await session.run("Your task")
# Example of accessing finish_params
print(finish_params["reason"])
print(finish_params["paths"]) # e.g., ["output.png"]
# Example of aggregating metadata
from stirrup import aggregate_metadata
aggregated = aggregate_metadata(metadata)
print(f"Total tokens: {aggregated['token_usage'].total}")