Custom tools
Tools are how the model acts on the world. Beyond the built-in tools, tool() lets you define your own — a typed function the model can call — from a Zod schema. The schema validates every call before your code runs, so your handler only ever sees well-formed input. Custom tools are appended after the built-ins and go through the same permission gate and allowedTools / disallowedTools filtering.
Defining a tool
The tool() signature
ToolContext
The handler's second argument carries per-call services provided by the kernel:
Security metadata
opts.security declares what a tool can reach, typed as ToolSecurity:
Strict assemblers consume this metadata: @lite-agent/local refuses custom tools that lack security or declare network beyond "loopback". Declare it honestly — it is what lets hardened presets decide whether your tool may run.
See also
- Built-in tools — the tool set that ships with the SDK.
- Permissions — gate custom and built-in tools with allow / ask / deny rules.
- Agent SDK overview — where custom tools fit in the assembled agent.
- CLI example — a full agent wiring custom tools end to end.