Creates a model response for a given Agent using Vercel AI SDK compatible format.
api.langdock.com with your deployment’s base URL: <deployment-url>/api/publicuseChat hook and other Vercel AI SDK features.| Parameter | Type | Required | Description |
|---|---|---|---|
agentId | string | One of agentId/agent required | ID of an existing agent to use |
agent | object | One of agentId/agent required | Configuration for a temporary agent |
messages | array | Yes | Array of UIMessage objects (Vercel AI SDK format) |
stream | boolean | No | Enable streaming responses (default: false) |
output | object | No | Structured output format specification |
maxSteps | integer | No | Maximum number of tool steps (1-20) |
imageResponseFormat | string | No | Response format for agent-generated images. "url" returns a signed URL, "b64_json" returns base64-encoded image data. |
messages array should contain:
| Type | Fields | Description |
|---|---|---|
text | type: "text", text: string | Plain text content |
file | type: "file", mediaType: string, url: string, filename?: string | Inline file reference |
| Type | Key Fields | Description |
|---|---|---|
text | type: "text", text: string | Text response |
reasoning | type: "reasoning", text: string | Model reasoning / chain-of-thought |
tool-{name} | type: "tool-{name}", toolCallId: string, state: "input-streaming" | "input-available" | "output-available" | "output-error", input?: any, output?: any, errorText?: string | Tool call and result |
source-url | type: "source-url", sourceId: string, url: string, title?: string | Web source reference |
source-document | type: "source-document", sourceId: string, mediaType: string, title: string, filename?: string | Document source reference |
metadata.attachments array. Do not use type: "file" parts for uploaded attachments — that format is reserved for inline file references (e.g., data URIs).agent parameter, you can specify:
name - Name of the agent (max 64 chars)instructions - System instructions (max 16384 chars)description - Optional description (max 256 chars)temperature - Temperature between 0-1model - Model ID to use (see Available Models for options)capabilities - Enable features like web search, data analysis, image generation, canvasknowledgeFolderIds - IDs of knowledge folders to useattachmentIds - Array of UUID strings identifying attachments to use
output parameter:
| Field | Type | Description |
|---|---|---|
type | ”object” | “array” | “enum” | The type of structured output |
schema | object | JSON Schema definition for the output (for object/array types) |
enum | string[] | Array of allowed values (for enum type) |
output parameter behavior depends on the specified type:
type: "object" with no schema: Forces the response to be a single JSON object (no specific structure)type: "object" with schema: Forces the response to match the provided JSON Schematype: "array" with schema: Forces the response to be an array of objects matching the provided schematype: "enum": Forces the response to be one of the values specified in the enum arraystream is set to true, the API returns a stream using the Vercel AI SDK streaming format, compatible with the useChat hook and other Vercel AI SDK features.
attachmentId (UUID) for each file. You can then use attachments in two ways:
metadata.attachments array. This lets you reference different files in different messages within the same conversation.attachments array when creating or updating a persistent agent. All messages sent to that agent will have access to these files.messages array with the agent’s response:
messages array. Each message has:
id - Unique identifier for the messagerole - Always "assistant" for completion responsescontent - The agent’s text response as a plain stringoutput parameter, the response will automatically include an output field containing the formatted structured data. The type of this field depends on the requested output format:
output.type was “object”: Returns a JSON object (with schema validation if schema was provided)output.type was “array”: Returns an array of objects matching the provided schemaoutput.type was “enum”: Returns a string matching one of the provided enum values429 Too Many Requests response.
Please note that the rate limits are subject to change. Refer to this documentation for the most up-to-date information.
400 - Invalid request parameters, malformed message format, agent not found, or agent not shared with API key401 - Invalid or missing API key429 - Rate limit exceeded500 - Server errorAPI key as Bearer token. Format "Bearer YOUR_API_KEY"
ID of an existing agent to use
Array of UIMessage objects (Vercel AI SDK format)
Specification for structured output format. When type is object/array and no schema is provided, the response will be JSON but can have any structure. When the type is enum, you must provide an enum parameter with an array of strings as options.
Response format for images generated by the agent. "url" returns a signed URL, "b64_json" returns base64-encoded image data.
url, b64_json