NewWacht Bench is live — AI-assisted development for Wacht

runAgentThread()

Starts an agent run on a thread with an execution payload.

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 runThread(threadId: string) {  const client = await wachtClient();  return client.ai.runAgentThread(threadId, {    prompt: 'Summarize open tasks and blockers.',  });}

Signature

function runAgentThread(  threadId: string,  request: ExecuteAgentRequest,): Promise<ExecuteAgentResponse>

ExecuteAgentRequest

threadId: string;
Target actor project thread id.
request: ExecuteAgentRequest;
Request payload object sent to the backend API.
prompt?: string | undefined;
prompt value used by this request.

Return value

result?: ExecuteAgentResponse | undefined;
Operation result payload.

Examples

AI usage pattern

import { wachtClient } from '@wacht/nextjs/server';export async function runAndInspect(threadId: string) {  const client = await wachtClient();  const run = await client.ai.runAgentThread(threadId, {    prompt: 'Summarize current blockers and next actions.',  });  const events = await client.ai.listThreadEvents(threadId);  return { run, events };}

On this page