Agent Integration
Embed, call, or drive your agent from your own applications.
Once an agent is built, you can wire it into your own product in three ways — embed a prebuilt chat widget, call the REST API, or drive it with the JavaScript SDK. This page walks through all three, along with the credentials and domain rules they share. Find them under Manage Agent → Agent Integration.

<BASE_URL> in every sample on this page is a placeholder for the Qore API host your organization uses. Confirm your production host with your Uptiq contact or your platform administrator before you ship — it differs by deployment, and a sample host will not work against your environment.
Choosing an integration
Start by matching the integration to where your agent runs and how much of the interface you want to own. The table below maps each option to its runtime; the sections that follow document each one in full.
Drop a chat onto a web page with no UI to build
Embed widget
Browser (prebuilt UI)
Call the agent from a backend, service, or scheduled job
REST API
Server-to-server (no browser)
Build your own custom chat UI in the browser
JS SDK
Browser (your UI)
Shared prerequisites. All three connect using credentials and domain rules configured on the agent:
Widget Key
Agent Config Panel → Authentication
Embed, JS SDK (and optionally the API)
API Key + Secret
Agent Config Panel → Authentication
REST API (server-to-server)
Whitelisted domain
Agent Config Panel → Whitelisted Domains
Embed, JS SDK — add the full URL or hostname, no trailing spaces
To obtain a Widget Key: open your agent's Agent Config Panel → Authentication tab, then create and copy the key. To whitelist a domain: open Agent Config Panel → Whitelisted Domains, then add and save your domain.
Set up Authentication first. Then add your allowed hosts in Whitelisted Domains.
Wherever you supply a user object, it must represent a trusted, authenticated identity from your own auth system — the user currently logged into your application and verified by your auth system. Never populate it from query parameters or untrusted input, which can be manipulated.
Embedding
Embedding is the quickest path — a prebuilt chat UI you drop onto a page, with no interface to build yourself.
The Embed Agent widget is a drop-in chat interface backed by @uptiqai/widgets-sdk. It comes as React components or a framework-agnostic HTML web component, and each offers a compact Chat Widget (floating popover) or an immersive Full Screen layout with sidebar navigation. The widget handles conversation state, history, and messaging for you.
Install
Import the stylesheet once in your application entry point:
Chat Widget vs. Full Screen — both share the same config, user, theme, instanceId, and ref API. Full Screen adds a hideTrigger / hide-trigger option to hide the default launcher and open via your own button. Expand the variant you need:
Props / attributes reference
React uses props (objects); the HTML web component uses attributes (JSON-stringified objects, kebab-case names). Otherwise they map 1:1.
config
config
Yes
WidgetConfig
Backend/agent config — see below.
user
user
Yes
WidgetUser
Authenticated user — see below.
instanceId
instance-id
No
string
Unique ID when rendering multiple widgets on one page. Default: auto-generated.
theme
theme
No
WidgetTheme
Palette overrides — see Theme customization.
defaultExecutionId
default-execution-id
No
string
Start with a specific conversation/execution loaded (continue a previous chat).
onExecutionChange
—
No
(executionId?) => void
Fires when the current conversation changes.
defaultOpen
default-open
No
boolean
Open on mount. Default false.
hideTrigger
hide-trigger
No
boolean
(Full Screen) Hide the default launcher; open via your own button + ref. Default false.
onClose
—
No
() => void
Fires when the user closes the widget.
widgetRef
—
No
React.Ref<…Ref>
Programmatic open() / close() control.
config (required) — WidgetConfig:
user (required) — WidgetUser:
Security: populate user from your authenticated session — e.g. const currentUser = useAuth(); — never from query params, form input, or other untrusted sources.
Theme customization
Pass a theme (React object / HTML JSON string) to match your design system:
Examples
Features
Chat interface (floating popover or full-screen) with responsive design
Conversation sidebar for managing multiple chats
New chat creation for starting fresh conversations
Message history persistence across sessions
Real-time messaging with the AI agent
Agent avatar display in the trigger button
Customizable theming to match your brand
TypeScript support with full type definitions
Browser support
All modern browsers: Chrome/Edge (latest), Firefox (latest), Safari (latest), and mobile browsers (iOS Safari, Chrome Mobile).
Troubleshooting
Widget not appearing — ensure you imported the CSS (
import '@uptiqai/widgets-sdk/dist/style.css';), that both required props (configanduser) are provided, and that your Widget Key is correct and active."Unauthorized" errors — confirm your application's domain is whitelisted exactly (full URL with protocol or hostname only, no trailing spaces).
REST API & JS SDK
When you'd rather drive the agent from your own code than a prebuilt UI, reach for one of these two. The REST API runs server-to-server with no browser; the JS SDK runs in the browser so you can build a fully custom chat interface. Pick a tab:
REST API
The Headless Agent Trigger API invokes an agent over HTTP — no UI or browser. Use it for backend services, scheduled jobs, or any workflow that starts the agent from your own systems.
Base URL:
<BASE_URL>· Format: JSON
Authentication
Every request must include exactly one of the following header sets.
Trigger an agent
Starts a new agent execution or resumes a paused one.
Path parameters
agentId
string
Yes
The unique identifier of the agent to run.
Request body — provide either message or resumeData; all other fields are optional.
message
string
The instruction sent to the agent. Required for new executions.
payload
object
Structured data sent alongside message for programmatic inputs.
documents
array
File attachments. See Document handling.
executionId
string
Specific execution ID. Auto-generated if omitted.
executionMode
string
async (default) or sync. Use sync only when you need an immediate response.
responseFormat
string
Markdown (default) or Json.
webhooks
array
Webhook URLs to receive execution updates. See Webhooks.
Success response: { "executionId": "exec_123" }
Document handling
Attaching documents is a two-step process: upload the file, then reference it in the trigger request.
Webhooks
Register webhooks in the trigger request to receive real-time updates when an execution completes or needs input:
Your endpoint receives:
Common examples
Error responses
400
Invalid request
{ "error": "Message or resume data is required" }
401
Bad credentials
{ "error": "Invalid or missing agent API key" }
403
Forbidden
{ "message": "You're not authorized to perform this action." }
500
Server error
{ "message": "Something went wrong. Please try again later." }
JS SDK
The Headless Agent JS SDK lets you build a custom chat interface while it handles the socket connection, real-time agent events, and file uploads automatically. Runs in the browser (React, Vue, or vanilla JS). Entry point: createHeadlessAgentInstance(params), which returns an instance with emit(), on(), and cleanup() methods.
Install & import
Authentication uses the Widget Key; your application's domain must be whitelisted (see Shared prerequisites above).
Create an instance
config
WidgetConfig
Yes
serverUrl, agentId, widgetKey, optional agentExecutorVersion.
user
WidgetUser
Yes
uid, firstName, email (required); lastName (optional).
instanceId
string
Yes
Unique identifier used for socket scoping.
Instance API
emit
(event: 'query', payload: QueryPayload) => void
Send a query to the agent, optionally with file attachments.
on
(event: 'agent-interrupt', handler) => () => void
Subscribe to agent events. Returns an unsubscribe function.
cleanup
() => void
Remove listeners and disconnect the socket (call on unmount).
React integration example
Best practices
Single instance — create one instance per chat context and reuse it for the whole conversation.
Subscribe before sending — attach your
on('agent-interrupt', …)handler before the firstemitso no responses are missed.Handle multiple subtypes — capture
final,question, andfinal_stream, not justfinal.Always clean up — call
cleanup()on unmount to prevent memory leaks.Persist
executionId— store and pass it to continue a conversation across page reloads.Let the SDK handle uploads — pass
Fileobjects; presigned-URL upload is automatic.
How this relates to the agent's other settings
Whichever integration you choose, a few other settings shape how it behaves:
Authentication — the keys generated there are the credentials your embed widget, JS SDK, or API integration uses.
Whitelisted Domains — for the embed widget and JS SDK, the agent only runs on domains in this list.
Secrets & Variables — the credentials and values the agent uses at runtime; the widget, SDK, and API all invoke the agent against these same configured secrets.
Tighten these before you publish embeds or share API credentials — once a widget is live on a page, every visitor reaches the agent through whatever auth and domain rules you have set.
Last updated

