NewWacht Bench is live — AI-assisted development for Wacht

listAgentKnowledgeBases()

This method lists knowledge bases attached to one agent.

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';  return client.ai.listAgentKnowledgeBases(agentId);}

Signature

function listAgentKnowledgeBases(  agentId: string,  client?: WachtClient,): Promise<PaginatedResponse<AiKnowledgeBaseWithDetails>>

Parameters

agentId: string;
Target agent id.

Return value

data?: AiKnowledgeBaseWithDetails[] | undefined;
Current page result items.
has_more?: boolean | undefined;
Whether additional pages are available.
limit?: number | undefined;
Effective page size when returned by backend.
offset?: number | undefined;
Effective offset when returned by backend.

Examples

AI usage pattern

import { wachtClient } from '@wacht/nextjs/server';export async function createKbAndUpload(file: File) {  const client = await wachtClient();  const kb = await client.ai.createKnowledgeBase({    name: 'Support Docs',    description: 'Knowledge base for support runbooks',  });  const doc = await client.ai.uploadKnowledgeBaseDocument(kb.id, file, 'runbook.md', 'Support runbook');  return { kb, doc };}

On this page