Skip to content

AgentAsToolOptions

Defined in: src/agent/agent-as-tool.ts:21

Options for creating an agent tool via Agent.asTool.

optional name?: string;

Defined in: src/agent/agent-as-tool.ts:29

Tool name exposed to the parent agent’s model. Must match the pattern [a-zA-Z0-9_-]{1,64}.

Defaults to the agent’s name. Throws if the resolved name is not a valid tool name — provide an explicit name option to override.


optional description?: string;

Defined in: src/agent/agent-as-tool.ts:38

Tool description exposed to the parent agent’s model. Helps the model understand when to use this tool.

Defaults to the agent’s description, or a generic description if the agent has no description set.


optional preserveContext?: boolean;

Defined in: src/agent/agent-as-tool.ts:52

Whether to preserve the agent’s conversation history across invocations.

When false (default), the agent’s messages and state are reset to the values they had at the time the tool was created, ensuring every call starts from the same baseline.

When true, the agent retains its conversation history across invocations, allowing it to build context over multiple calls.

false