class FinishTool
Bases:ToolDefinition[FinishAction, FinishObservation]
Tool for signaling the completion of a task or conversation.
Methods
create() -> Sequence[Self] source Create FinishTool instance. Parameters:conv_stateConversationState | None – Optional conversation state (not used by FinishTool).**params– Additional parameters (none supported).
- Sequence[Self] A sequence containing a single FinishTool instance.
-
ValueError– If any parameters are provided.NoneparamsNone
class ThinkTool
Bases:ToolDefinition[ThinkAction, ThinkObservation]
Tool for logging thoughts without making changes.
Methods
create() -> Sequence[Self] source Create ThinkTool instance. Parameters:conv_stateConversationState | None – Optional conversation state (not used by ThinkTool).**params– Additional parameters (none supported).
- Sequence[Self] A sequence containing a single ThinkTool instance.
-
ValueError– If any parameters are provided.NoneparamsNone
None
None
None
None
class Action
Bases:Schema, ABC
Base schema for input action.
Properties
visualize: Text Return Rich Text representation of this action.
class Observation
Bases:Schema, ABC
Base schema for output observation.
Properties
ERROR_MESSAGE_HEADER: strcontent: list[TextContent | ImageContent] Content returned from the tool as a list of TextContent/ImageContent objects. When there is an error, it should be written in this field.is_error: bool Whether the observation indicates an errortext: str Extract all text content from the observation.
to_llm_content: Sequence[TextContent | ImageContent] Default content formatting for converting observation to LLM readable content. Subclasses can override to provide richer content (e.g., images, diffs).visualize: Text Return Rich Text representation of this observation.
Methods
from_text() -> Self source Utility to create an Observation from a simple text string. Parameters:textstr – The text content to include in the observation.is_errorbool – Whether this observation represents an error.**kwargsAny – Additional fields for the observation subclass.
-
Self An Observation instance with the text wrapped in a TextContent.
NoneNoneNone
class Tool
Bases:BaseModel
Defines a tool to be initialized for the agent.
This is only used in agent-sdk for type schema for server use.
Properties
name: str Name of the tool class, e.g.,params: dict[str, Any] Parameters for the tool
Methods
validate_name() -> str source Validate that name is not empty.None
None
class ExecutableTool
Bases:Protocol
Protocol for tools that are guaranteed to have a non-None executor.
This eliminates the need for runtime None checks and type narrowing
when working with tools that are known to be executable.
Properties
name: strexecutor: ToolExecutor[Any, Any]
class ToolAnnotations
Bases:BaseModel
Annotations to provide hints about the tool’s behavior.
Based on Model Context Protocol (MCP) spec:
https://github.com/modelcontextprotocol/modelcontextprotocol/blob/caf3424488b10b4a7b1f8cb634244a450a1f4400/schema/2025-06-18/schema.ts#L838
Properties
model_config: ConfigDicttitle: str | None A human-readable title for the tool.readOnlyHint: bool If true, the tool does not modify its environment. Default: falsedestructiveHint: bool If true, the tool may perform destructive updates to its environment. If false, the tool performs only additive updates. (This property is meaningful only whenreadOnlyHint == false) Default: trueidempotentHint: bool If true, calling the tool repeatedly with the same arguments will have no additional effect on the its environment. (This property is meaningful only whenreadOnlyHint == false) Default: falseopenWorldHint: bool If true, this tool may interact with an
class ToolDefinition
Bases:DiscriminatedUnionMixin, ABC
Base class for all tool implementations.
This class serves as a base for the discriminated union of all tool types.
All tools must inherit from this class and implement the .create() method for
proper initialization with executors and parameters.
Features:
- Normalize input/output schemas (class or dict) into both model+schema.
- Validate inputs before execute.
- Coerce outputs only if an output model is defined; else return vanilla JSON.
- Export MCP tool description.
Properties
model_config: ConfigDictname: strdescription: straction_type: type[Action]observation_type: type[Observation] | Noneannotations: ToolAnnotations | Nonemeta: dict[str, Any] | Noneexecutor: SkipJsonSchema[ToolExecutor | None]title: str
Methods
abstractmethod create() -> Sequence[Self] source Create a sequence of Tool instances. This method must be implemented by all subclasses to provide custom initialization logic, typically initializing the executor with parameters from conv_state and other optional parameters. Parameters:*args– Variable positional arguments (typically conv_state as first arg).**kwargs– Optional parameters for tool initialization.
- Sequence[Self] A sequence of Tool instances. Even single tools are returned as a sequence
-
Sequence[Self] to provide a consistent interface and eliminate union return types.
argsNonekwargsNone
None
- ExecutableTool This tool instance, typed as ExecutableTool.
NotImplementedError– If the tool has no executor.
argumentsdict[str, Any] – The parsed arguments from the tool call.
-
Action The action instance created from the arguments.
None
-
input_schemadict[str, Any] | None – Optionally override the input schema. -
output_schemadict[str, Any] | None – Optionally override the output schema.NoneNone
-
add_security_risk_predictionbool – Whether to add asecurity_riskfield to the action schema for LLM to predict. This is useful for tools that may have safety risks, so the LLM can reason about the risk level before calling the tool. -
action_typetype[Schema] | None – Optionally override the action_type to use for the schema. This is useful for MCPTool to use a dynamically created action type based on the tool’s input schema.NoneNone
-
add_security_risk_predictionbool – Whether to add asecurity_riskfield -
action_typetype[Schema] | None – Optional override for the action typeNoneNone
kindstr – The name of the tool class to resolve
- type The tool class corresponding to the kind
-
ValueError– If the kind is unknownNone
class ToolExecutor
Bases:ABC
Executor function type for a Tool.

