Integrate an agent
Every way to put an agent to work: attach it to a Qore app, embed a chat widget, call the Agent API, or build your own chat UI.
This guide is organized by task. Find what you want to do in the list below, then follow the steps.
Add an existing agent to an app I built in Qore
Build a new agent for my Qore app
Ask the app builder to add an agent
Choose how to run the agent in my own app
Open the integration options
Create the keys an integration needs
Allow the domains the widget runs on
Drop a chat widget onto my website
Use the widget without React, or full screen
Tell the widget who the user is
Call the agent from my backend
Generate an API key and secret
Choose the client, mode, and dialect
Get the agent's answer
Send a document with a request
Pass variables, a user ID, or a business ID
Get updates by webhook
Stop a running execution
List the agent's conversations
Understand an error response
Download the setup as a Markdown file
Build my own chat UI in the browser
Send the signed-in user's identity
Pass the caller's identity to an MCP server
Check the integration works
Add an agent to a Qore app
Attach an agent to a Qore app
You can't attach agents while the app is still generating. If you see Cannot attach agents while application generation is in progress, wait for the build to finish, or Skip the pending build step, then try again.
Build a new agent for the app
On the app's Agents tab, under Build an Agent, select Visit Agent Builder. Build the agent there, then come back and attach it. See Create an agent.
Ask the app builder to add an agent
In the app's build conversation, under Upgrade your app, select Add an AI Agent (Connect intelligence to your app).
Run the agent in your own app
Choose an integration
Drop a chat onto a web page, with no UI to build
Embedded Chat
Widget key, allowed domain
Call the agent from a backend, service, or scheduled job
Agent API with the raw (HTTP) client
API key and secret
Build your own chat UI in the browser
Agent API with the TypeScript SDK client
Widget key, allowed domain
Open Integrate Agent
In the agent's builder, select Integrate Agent (</>) in the canvas header. It opens as a side panel with two tabs: Embedded Chat and Agent API.
Create the keys
Open Agent Config › Access & Security, select + Add Key, name it, choose the type, and select Generate Key:
Widget Key — for Embedded Chat and the TypeScript SDK. Safe to ship in browser code.
API Key — a key and secret pair for server-to-server calls. Copy the secret straight away; it's shown only once.
The Embedded Chat and Agent API tabs can also create keys for you. See Create an agent › Create an access key.
Allow your domains
In Access & Security, under Allowed Domains, select + Add New Domain, enter each origin the widget runs on, and select Save. With the list empty, the widget runs nowhere outside the platform. Enter each domain exactly as the browser sends it, such as https://app.example.com.
Embedded Chat
Embed a chat widget
The widget has a chat popover or full-screen view, a conversation sidebar, new chats, message history that persists across sessions, and theming.
Use the HTML web component or full screen
The widget also comes as a framework-agnostic HTML web component, and each form has a full-screen variant. Both share the same config, user, theme, and instanceId. Full screen adds hideTrigger (or hide-trigger in HTML), so you can open it from your own button. See Integrate Agent › Widget variants.
Pass the signed-in user
Set user to the person signed in to your app: uid, firstName, and email are required, and lastName is optional.
user must come from your own authentication system. Never fill it from query parameters or other input a visitor can change.
Agent API
Call the agent from my backend
The Agent API's raw HTTP client triggers the agent with no UI. Send a POST to the trigger endpoint with the API key and secret:
The request body needs message for a new execution (or resumeData to resume a paused one). Optional fields include payload, documents, executionId, executionMode (async, the default, or sync), responseFormat (Markdown or Json), webhooks, and token.
Generate an API key and secret
On the Agent API tab, select Generate new secret key. It creates a new key and secret and shows the secret once; copy it straight away. Generating doesn't deactivate any existing key. Keep both values server-side.

Choose the client, mode, and dialect
The Agent API tab builds one code sample from three selectors. Select Copy to copy it.
Client
raw (HTTP), TypeScript SDK, and Python SDK (marked Coming soon)
Mode
Sync, Async, and Realtime
Dialect
Native (Qore's own request shape) and OpenAI
Get the result
Async (the default) — the trigger returns
{ "executionId": "exec_123" }, an acknowledgement, not an answer. Check the execution's queue status, or receive a webhook.Sync — the call waits until the agent finishes, and returns the answer in
result.content. Use it only when you must wait for the result.
Check an execution with GET /agent-executor/1.4/agents/:agentId/executions/:executionId/queue-status. Messages sent to the same executionId run one at a time: one shows Executing, the rest Pending.
Send a document
The older documents/presigned-url endpoint is deprecated.
Pass variables, a user ID, or a business ID
Add these to the trigger request:
uid— the calling user's ID in your system.variables— key/value pairs the agent's instructions can reference. Every key must already be declared in the agent's variables; an undeclared key is rejected.businessId— attributes the run to a business or tenant of your own.
Get updates by webhook
Add webhook URLs to webhooks in the trigger request to receive updates when an execution completes or needs input. Webhooks need executor version 1.2 or later.
Each webhook carries an X-Webhook-Signature header: an RSA-SHA256 signature of the raw JSON body. Verify it against the public key shown on the agent's Agent API screen.
Stop a running execution
POST /agent-executor/1.4/agents/:agentId/executions/:executionId/abort. The agent stops and emits a final done event. You can also cancel a message that's still Pending.
List the agent conversations
GET /agent-executor/1.4/agents/:agentId/conversations returns titles and metadata, not transcripts. Add ?initiatedBy=user_123 to filter to one user. You can also fetch one conversation's transcript by its executionId.
Understand an error response
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." }
Download the setup as Markdown
Select Download as MD on the Agent API tab, or on Embedded Chat's Install widget step. A preview shows the file: the agent's name, executor version and base URL, the credentials guidance, and the sample you chose.
On the Agent API tab, Include secrets writes the agent's API key and secret into the file, so it works as-is.

A file downloaded with Include secrets is a credential. Anyone who has it can call the agent. If it leaks, deactivate the key in Access & Security.
For every endpoint and field, see Integrate Agent › Agent API.
Your own chat UI
Build my own chat UI
Choose the TypeScript SDK client on the Agent API tab. The headless SDK handles the connection to the agent while you build the interface. It uses the widget key, and your domain must be on Allowed Domains.
config, user, and instanceId are required; authToken is optional. See Integrate Agent › TypeScript SDK client.
Identity
Send the signed-in user token
When the agent has Authentication turned on, send the signed-in user's identity token with each request:
Agent API — add
tokenbesidemessagein the trigger body.Embedded Chat — pass
authTokenin React, orauth-tokenin HTML.TypeScript SDK — pass
authTokenwhen you create the instance. A headless instance also hassetAuthToken()for refreshed tokens.
Off
Any, or none
The run proceeds; the token is ignored.
On
None
The run proceeds, with no authenticated caller.
On
Valid
The run proceeds, and $auth.token holds the token.
On
Invalid, or for another app
Rejected with AGENT_AUTHENTICATION_FAILED.
On
Expired Microsoft Entra ID
Rejected with TOKEN_EXPIRED.
Send tokens only from your app's authenticated session. Never accept them from URLs, form fields, or other input a visitor controls.
Pass the caller identity to an MCP server
In an MCP connection's configuration, reference $auth.token where the server expects a user credential. Qore replaces it with the verified token during the run, so the server can apply the caller's permissions. $auth.token works only in MCP connection configurations; with no token, it resolves empty. See Authentication.
Check and fix
Verify the integration
A Qore app — preview the app and confirm the agent responds and uses its knowledge and skills.
Your own app — send a request from your surface and confirm the agent answers. It responds only where your keys and domains allow.
Runs — find each run in Control Center › Observe › Runs & Traces.
Common issues
"Cannot attach agents while application generation is in progress." Let the app's build finish, or Skip the pending step, then attach.
Proceed is greyed out in Attach Agent(s). Tick at least one agent.
The widget doesn't appear. Import the stylesheet, provide both
configanduser, and check the widget key is correct and active."Unauthorized" errors from the widget. The page's domain isn't on Allowed Domains exactly as the browser sends it, including protocol, subdomain, and port.
API calls return
401. Check thex-api-keyandx-api-key-secretvalues. If you lost the secret, generate a new pair.A request with variables is rejected. Declare every variable key on the agent first.
No webhook arrives. Webhooks need executor version 1.2 or later.
Requests with a token are rejected. Check the provider details in Authentication, and that the token was issued for the configured application or client.
Related pages
Build the agent first: Create an agent
Build the host app: Create an app
Maintained by Abhishek Paul
AI-assisted, human-approved

Last updated
Was this helpful?




