AgentSea.Tool behaviour (agentsea_core v0.1.0)

Copy Markdown

A callable tool. A tool is a module implementing this behaviour — introspectable, testable, and supervisable. The parameter schema is a NimbleOptions keyword spec (not Zod), used both to validate calls and to advertise the tool to providers.

Summary

Callbacks

Human/model-readable description of what the tool does.

Unique tool name as seen by the model.

Whether a human must approve before execution (HITL). Defaults to false.

Execute the tool with validated params and an execution context.

NimbleOptions schema describing the tool's parameters.

Callbacks

description()

@callback description() :: String.t()

Human/model-readable description of what the tool does.

name()

@callback name() :: String.t()

Unique tool name as seen by the model.

needs_approval?()

(optional)
@callback needs_approval?() :: boolean()

Whether a human must approve before execution (HITL). Defaults to false.

run(params, ctx)

@callback run(params :: map(), ctx :: map()) :: {:ok, term()} | {:error, term()}

Execute the tool with validated params and an execution context.

schema()

@callback schema() :: keyword()

NimbleOptions schema describing the tool's parameters.