NewWacht Bench is live — AI-assisted development for Wacht

attachAgentTool()

This method manages AI tool definitions or agent-to-tool bindings.

Usage

The following example shows a basic usage of the backend client from @wacht/nextjs/server.

import { wachtClient } from '@wacht/nextjs/server';export async function example() {  const client = await wachtClient();  const agentId: string = 'agentid-123';  const toolId: string = 'toolid-123';  return client.ai.attachAgentTool(agentId, toolId);}

Signature

function attachAgentTool(  agentId: string,  toolId: string,  client?: WachtClient,): Promise<void>

Parameters

agentId: string;
Target agent id.
toolId: string;
Target tool id.

Examples

AI usage pattern

import { wachtClient } from '@wacht/nextjs/server';export async function attachTool(agentId: string) {  const client = await wachtClient();  const tool = await client.ai.createTool({    name: 'fetch-user-profile',    kind: 'api',    configuration: {},  });  await client.ai.attachAgentTool(agentId, tool.id);  return tool;}

On this page