Skip to content

@anvia/extensions ​

@anvia/extensions collects ready-made building blocks for Anvia agents: toolkits for files, shell commands, git, HTTP, web search and fetch, task lists, notes, dates, and math; tool wrappers for caching, timeouts, retries, rate limits, and summaries; guardrail policies; agent middlewares; and lifecycle hooks for usage, cost, and audit records. Every export plugs into an existing Agent option, so you can adopt one piece without the rest.

Pre-1.0

@anvia/extensions is 0.x. Minor releases may change option names, defaults, and tool schemas, and the package is outside the stable v1 boundary. Pin the version and read the release notes before upgrading.

Install ​

sh
pnpm add @anvia/core @anvia/extensions zod

The reviewed release is 0.3.0. It declares peer dependencies on @anvia/core ^1.25.1 and zod ^4.6.7, has no other runtime dependencies, is ESM-only, and requires Node.js 20.3 or newer. Toolkits are built on core's createToolkit, so the toolkit options include, exclude, prefix, requiresApproval, timeoutMs, and instructions work the same way here.

Where each export plugs in ​

SubpathExportsAgent option
@anvia/extensions/tools/fsfilesystem()tools
@anvia/extensions/tools/shellshell()tools
@anvia/extensions/tools/gitgit()tools
@anvia/extensions/tools/httphttpClient()tools
@anvia/extensions/tools/web-fetchwebFetch()tools
@anvia/extensions/tools/web-searchwebSearch() and eight search providerstools
@anvia/extensions/tools/todotodo()tools
@anvia/extensions/tools/scratchpadscratchpad()tools
@anvia/extensions/tools/datetimedatetime()tools
@anvia/extensions/tools/mathmath()tools
@anvia/extensions/toolsAll toolkits above, plus withToolCache, withToolTimeout, withToolRetry, withToolRateLimit, withToolSummarytools
@anvia/extensions/guardrailspiiGuardrail, secretLeakGuardrail, patternGuardrail, promptInjectionGuardrail, topicGuardrail, lengthGuardrail, llmGuardrailguardrails
@anvia/extensions/middlewarestoolOutputLimit, redactToolOutput, redactCompletionRequest, sanitizeToolErrors, historyWindowmiddlewares
@anvia/extensions/hooksusageHook, costHook, auditHook, jsonlHook, consoleHooklifecycle
@anvia/extensionsEverything above—

Import from the narrowest subpath. The root and the ./tools barrel load every module, including the Node-only ones.

Runtime support ​

Several modules import Node built-ins at load time, so they do not run on edge or browser runtimes:

Node-onlyWhy
tools/fs, tools/shell, tools/gitFile system and child processes
tools/http, tools/web-fetch, tools/web-searchDNS checks and pinned Node HTTP requests for URL safety
hooks (through jsonlHook)Appends to a local file
@anvia/extensions, @anvia/extensions/toolsRe-export the modules above

tools/todo, tools/scratchpad, tools/datetime, tools/math, guardrails, and middlewares import only @anvia/core and zod. Some wrappers and providers call .unref() on timers, which is a Node API; verify the exact module on any non-Node runtime before relying on it.

Next steps ​

For the concepts underneath, see Toolkits, Guardrails, Tool middleware, and Lifecycle hooks.

Built for Anvia.