Skip to main content

v3.6.0

Released: November 15, 2026

Highlights​

  • interceptTool on a request: one hook that wraps every tool call of that request. It can stop a call, change its result, or just watch it
  • interceptTool per agent run: the same hook, set for one agent run
  • conversationSearch option: leave out the built-in conversation_search tool, 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: ToolInterceptor and InterceptedToolCall

@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:

FieldWhat it is
toolNameThe name of the tool the model called
argsThe arguments the model passed
roundThe 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:completed and log events are sent only when run() 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
  • interceptTool is only for the SDK. It is never sent to the provider
  • Requests without interceptTool behave exactly as before

New exports​

ExportWhat it is
ToolInterceptor(call: InterceptedToolCall, run: () => Promise<string>) => Promise<string> | string
InterceptedToolCall{ toolName, args, round }, the call as the interceptor sees it
CompletionRequest.interceptToolNew 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 mindWhat changes
Mind headerOnly holds the chosen kinds. With ['belief'] it has no goals and no reflections
ToolsOnly the chosen kinds' tools are given to the agent. With ['belief'] there are no goal or reflection tools
mind_recallOnly searches the chosen kinds, whatever type the model asks for. Its type option only lists those kinds
Store readsA kind that is left out is not read at all

Which tools come with each kind:

KindTools
(always)mind_recall
beliefmind_believe
reflectionmind_reflect, mind_unpin_reflection
goalmind_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/agents 3.6.0 needs toolpack-sdk ^3.6.0, and @toolpack-sdk/knowledge ^3.6.0 when 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