Skip to content

You are currently viewing documentation for0.1.0-alpha.4

Saved documentation for 0.1.0-alpha.4 (npm) / 0.1.0a3 (PyPI). Interactive tools use the current release. View latest documentation.

Wrap LangChain tools

When to use this

Use this guide when your agent already exposes LangChain tools and you want toolAdapter to preserve name, description and schema while guarding the invoke / ToolCall executor. Prefer it after the quickstart. Batch and stream execution have not been qualified.

How to wrap tools

Illustrative offline tool. Install agindow@0.1.0-alpha.4, await ready, then wrap the tool collection you already own. toolAdapter preserves name, description and schema and guards the invoke / ToolCall executor.

ts
import { DynamicStructuredTool } from '@langchain/core/tools';
import { createAgindow } from 'agindow';
const sdk = createAgindow();
await sdk.ready;
const existing = new DynamicStructuredTool({
  name: 'search',
  description: 'Offline search fixture',
  schema: { type: 'object', properties: { query: { type: 'string' } }, required: ['query'] },
  func: async () => 'fixture result',
});
const tools = sdk.toolAdapter([existing]);
const search = tools[0];
if (search === undefined) throw Error('missing tool');
console.log(await search.invoke({ type: 'tool_call', id: 'call_fixture', name: 'search', args: { query: 'fixture' } }));

What to expect

Observe mode preserves original payloads, results and upstream exceptions. Installing and wrapping alone does not configure detection: the statistical guest is default; configure windows to detect. An empty recent() history is not a clean verdict. Selective repair stays off by default and needs reviewed rename rules plus independent verification. Python remains callable-only for this platform.

Reference

Use the Node reference for adapter signatures and the matrix for other framework shapes. The public LangChain page summarizes surface limits without replacing this how-to.