createAgent()
Creates an AI agent from the request payload and returns the created agent object.
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 createAgent() { const client = await wachtClient(); return client.ai.createAgent({ name: 'Support Agent', model: 'gpt-5.4-mini', });}Signature
function createAgent( request: CreateAiAgentRequest,): Promise<AiAgent>CreateAiAgentRequest
›name?: string | undefined;
name?: string | undefined;Agent display name.
›instructions?: string | undefined;
instructions?: string | undefined;Optional system instructions for this agent.
›model?: string | undefined;
model?: string | undefined;Optional default model identifier.
›description?: string | undefined;
description?: string | undefined;Optional agent description.
Return value
›id?: string | undefined;
id?: string | undefined;Created agent id.
›name?: string | undefined;
name?: string | undefined;Created agent display name.
›instructions?: string | undefined;
instructions?: string | undefined;Persisted instructions.
›model?: string | undefined;
model?: string | undefined;Persisted model setting.
Behavior
- Creates a new resource and returns the created object from the backend.
- Validate required fields before calling to avoid predictable request failures.