v3.6.0
Released: November 15, 2026
Highlights
interceptToolon a request: one hook that wraps every tool call of that request. It can stop a call, change its result, or just watch itinterceptToolper agent run: the same hook, set for one agent runconversationSearchoption: leave out the built-inconversation_searchtool, for example to give the agent your own- Agent Mind
kinds: choose which kinds of entry an agent remembers (beliefs, reflections, goals) - New exported types:
ToolInterceptorandInterceptedToolCall
@toolpack-sdk/knowledge has no changes in this release; it is bumped to 3.6.0 to keep the packages in step.
toolpack-sdk
New features
Stop or change a tool call with interceptTool
Pass an interceptTool function on generate() or stream(). It is called for every tool call of that request, whatever the tool: request tools, mode tools, registry tools and tool.search.
The function gets the call and a run() function:
- Call
run()to run the tool. You can return its result as it is, or change it first - Return text without calling
run()to stop the call. The tool does not run, and the model sees your text as the tool's result
import type { ToolInterceptor } from 'toolpack-sdk';
const interceptTool: ToolInterceptor = async (call, run) => {
if (call.toolName === 'fs.delete_file') {
return 'Deleting files is not allowed in this session.'; // the tool is not run
}
const result = await run();
return result.length > 10_000 ? result.slice(0, 10_000) + '\n[cut]' : result;
};
const response = await toolpack.generate({ model, messages, interceptTool });
What the interceptor sees:
| Field | What it is |
|---|---|
toolName | The name of the tool the model called |
args | The arguments the model passed |
round | The tool round of the request (1 for the first). Calls made in parallel in one round share it |
Notes:
- The tool's
tool:started,tool:completedand log events are sent only whenrun()is called. A stopped call sends none - A stop (
signal) still wins: once the request is aborted, the interceptor is not asked and no tool is started interceptToolis only for the SDK. It is never sent to the provider- Requests without
interceptToolbehave exactly as before
New exports
| Export | What it is |
|---|---|
ToolInterceptor | (call: InterceptedToolCall, run: () => Promise<string>) => Promise<string> | string |
InterceptedToolCall | { toolName, args, round }, the call as the interceptor sees it |
CompletionRequest.interceptTool | New optional field, ToolInterceptor |
@toolpack-sdk/agents
New features
interceptTool on a run
AgentRunOptions accepts interceptTool. It is passed to the run's request, so it wraps every tool call the agent makes in that run. It works the same way as in toolpack-sdk (see above): call run() to run the tool, or return text without calling it to stop the call.
const result = await agent.run('Clean up the reports folder', undefined, {
interceptTool: async (call, run) => {
if (call.toolName.startsWith('fs.delete')) return 'Ask the user before deleting anything.';
return run();
},
});
This is not the same as the agent's message interceptors (@toolpack-sdk/agents/interceptors), which handle incoming messages before invokeAgent. Runs without interceptTool behave as before.
conversationSearch option on BaseAgent
Every run that has a conversation gets the built-in conversation_search tool, so the model can look up older turns. Set conversationSearch to false to leave it out. This lets an app give the agent its own search tool under the same name.
class SupportAgent extends BaseAgent {
conversationSearch = false; // the app adds its own conversation_search tool
}
The conversation history still loads as before. Only the tool is left out. The default is true, so existing agents do not change.
Agent Mind: choose which kinds an agent remembers
AgentMindConfig accepts kinds, a list of 'belief', 'reflection' and 'goal'. The default is all three, as before.
import { OllamaEmbedder } from '@toolpack-sdk/knowledge';
class FactsAgent extends BaseAgent {
mind = {
embedder: new OllamaEmbedder({ model: 'nomic-embed-text' }),
kinds: ['belief'], // remembers facts only
};
}
With a shorter list, the kinds that are left out are switched off completely:
| Part of the mind | What changes |
|---|---|
| Mind header | Only holds the chosen kinds. With ['belief'] it has no goals and no reflections |
| Tools | Only the chosen kinds' tools are given to the agent. With ['belief'] there are no goal or reflection tools |
mind_recall | Only searches the chosen kinds, whatever type the model asks for. Its type option only lists those kinds |
| Store reads | A kind that is left out is not read at all |
Which tools come with each kind:
| Kind | Tools |
|---|---|
| (always) | mind_recall |
belief | mind_believe |
reflection | mind_reflect, mind_unpin_reflection |
goal | mind_set_goal, mind_update_goal, mind_complete_goal |
The list must name at least one kind. An empty list (or one with no valid kind) throws when the mind is set up. A kind named twice counts once.
Compatibility
- Node.js >= 20
- No new required dependencies
- No breaking changes. Code that does not use the new options needs no changes
@toolpack-sdk/agents3.6.0 needstoolpack-sdk^3.6.0, and@toolpack-sdk/knowledge^3.6.0when you use it
Install
npm install toolpack-sdk@3.6.0
npm install @toolpack-sdk/knowledge@3.6.0
npm install @toolpack-sdk/agents@3.6.0