Open Agent Loops
API Reference

Tool

@open-agent-loops/core


Defined in: tools/tools.types.ts:88

A tool the agent loop can call: name, description, argument schema, and handler.

Remarks

Author tools through defineTool so the args parameter of execute is inferred from parameters rather than the default z.ZodType.

See

Type Parameters

Type ParameterDefault typeDescription
S extends z.ZodTypez.ZodTypeThe Zod schema type for the tool's arguments.

Methods

execute()

execute(args, ctx): 
  | ToolResult
| Promise<ToolResult>;

Defined in: tools/tools.types.ts:108

Run the tool against validated args, returning its result.

Parameters

ParameterType
argsoutput<S>
ctxToolContext

Returns

| ToolResult | Promise<ToolResult>

Remarks

Throw to signal an error: the loop turns a thrown Error into a tool result with isError: true and error.message as the content the model sees. Any Error works — there is no special error type, and only the message is surfaced (so make it descriptive). Return a ToolResult for success, or for a soft outcome the model should simply read.

Throws

Surfaced to the model as an isError tool result, not propagated out of the run — the loop never lets one tool's throw reject the whole run.

Properties

PropertyTypeDescriptionDefined in
descriptionstringHuman/model-readable description of what the tool does.tools/tools.types.ts:92
executionMode?ExecutionModeSee ExecutionMode. Defaults to Parallel.tools/tools.types.ts:110
namestringUnique tool name advertised to the model.tools/tools.types.ts:90
parametersSZod schema for the tool's arguments; also converted to JSON Schema for the model.tools/tools.types.ts:94

On this page