Overview
The HTTP API allows you to communicate with your deployed Lua AI agents directly via HTTP requests. This is useful for building custom integrations, mobile apps, backend services, or any application that needs to interact with your agent programmatically.Stream Endpoint
Real-time streaming responses via SSE
Generate Endpoint
Single response generation
Base URL
Authentication
All requests require authentication via Bearer token in the Authorization header. You can use your API key as the token:Endpoints
Stream Chat Response
Stream a chat response using Server-Sent Events (SSE).Generate Chat Response
Generate a complete chat response (non-streaming).Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
agentId | string | Yes | The ID of your deployed agent. |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
channel | string | No | The channel context for the conversation. Options: web, whatsapp, email, slack, facebook, instagram. Defaults to undefined. |
identifier | string | No | A unique identifier for the message. Can be used for tracking purposes. |
Request Body
The request body follows the AI SDK 5UserContent format for messages.
Required Fields
| Field | Type | Description |
|---|---|---|
messages | UserContent | Array of content parts (text, image, or file). This is a single user message that can contain multiple parts. |
Optional Fields
| Field | Type | Description |
|---|---|---|
systemPrompt | string | Override the agent’s default persona/prompt |
runtimeContext | string | Additional context injected into the agent’s prompt |
Advanced Options (rarely needed)
Advanced Options (rarely needed)
These options are for advanced use cases and typically not needed for standard integrations:
| Field | Type | Description |
|---|---|---|
navigate | boolean | Enable navigation responses for web widget (default: false) |
skillOverride | array | Override the agent’s skills with specific sandbox versions |
personaOverride | string | Override the agent’s persona |
preprocessorOverride | array | Override preprocessors |
postprocessorOverride | array | Override postprocessors |
Message Content Types
Messages follow the AI SDK 5UserContent format:
Text Message
Image Message
File Message
Examples
Basic Text Request
Streaming Request
With Image Attachment
With System Prompt Override
UsesystemPrompt to temporarily override the agent’s persona for a specific request:
With Runtime Context
UseruntimeContext to inject additional context into the agent’s prompt:
With Channel Context
Specify the channel for channel-specific behavior:Response Format
Generate Response
The generate endpoint returns a complete response object:Stream Response
The stream endpoint returns Server-Sent Events (SSE) with JSON chunks:Error Responses
| Status Code | Description |
|---|---|
400 | Invalid request payload |
401 | Unauthorized - Invalid or missing token |
423 | Agent is disabled for this user |
500 | Internal server error |
Navigate Option
The
navigate option is specifically for web widget integrations. When enabled, it allows the agent to send navigation commands that direct users to specific pages on your website.navigate is true, the agent can include navigation components in its response that trigger the onNavigate callback in the LuaPop widget.
Learn More About Navigation
See the Navigate Component documentation for details on how navigation works with the web widget.
Best Practices
Use Streaming for Better UX
Use Streaming for Better UX
For user-facing applications, use the
/chat/stream endpoint to provide real-time feedback as the response is generated.Include Channel Context
Include Channel Context
When building integrations, specify the
channel parameter to help the agent format responses appropriately for the platform.Use Runtime Context Wisely
Use Runtime Context Wisely
The
runtimeContext field is great for injecting user-specific information or session context without modifying the agent’s core persona.Handle Streaming Properly
Handle Streaming Properly
When using the stream endpoint, ensure you properly handle the SSE format and parse each JSON chunk separately.
Use Cases
Mobile Apps
Build native mobile experiences with your Lua agent
Custom Integrations
Integrate with internal tools and systems
Voice Assistants
Power voice interfaces with AI responses
Automation
Trigger agent responses from workflows

