NewWacht Bench is live — AI-assisted development for Wacht

createAgentThread()

Creates a new agent thread for a project and returns the created thread.

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 createAgentThread(projectId: string) {  const client = await wachtClient();  return client.ai.createAgentThread(projectId, {    title: 'Planning Thread',  });}

Signature

function createAgentThread(  projectId: string,  request: CreateAgentThreadRequest,): Promise<AgentThread>

CreateAgentThreadRequest

projectId?: string | undefined;
Parent project id.
title?: string | undefined;
Thread title.
description?: string | undefined;
Optional thread description.

Return value

id?: string | undefined;
Created thread id.
project_id?: string | undefined;
Parent project id.
title?: string | undefined;
Created thread title.
archived_at?: string | null | undefined;
Archive timestamp when archived.

Behavior

  • Creates a new resource and returns the created object from the backend.
  • Validate required fields before calling to avoid predictable request failures.

On this page