Start your agent integration by embedding the chat into your web application and applying the appropriate security settings for your scenario. This getting started guide is designed for developers who want a clear, straightforward path to adding an agent-driven chat experience to a web application.Documentation Index
Fetch the complete documentation index at: https://developer.watson-orchestrate.ibm.com/llms.txt
Use this file to discover all available pages before exploring further.
If you are looking for an architectural overview of security, see Securing the embedded chat.
Integrating agents with web applications
Configure security for embedded chat
Security is enabled by default in both Draft and Live environments but not configured. You must explicitly configure it as described in the Configuring security for embedded chat section.
The embedded chat does not initialize unless the required cryptographic keys are configured and validated by the service.
Generate the embed script
Generate the script to embed the agent with your web application by using the
If you prefer to generate the script by using the UI, see Embedding the agent to web applications in the watsonx Orchestrate base documentation. The following procedure focuses on the command line-based workflow.Where:
Assign the name of the agent that you want to get the embed script.The previous code outputs a
channels webchat embed command.If you prefer to generate the script by using the UI, see Embedding the agent to web applications in the watsonx Orchestrate base documentation. The following procedure focuses on the command line-based workflow.
agent-nameAssign the name of the agent that you want to get the embed script.The previous code outputs a
<script> tag with configuration for your environment. You can add this script to an HTML page on your website. The following is an example of the command’s output:OUTPUT
The
/wxochat path is environment-specific.In the Developer Edition, for local environment, the /wxochat prefix is not present.
In production environments, the /wxochat prefix is required and appears in the embed script.Add the script to your web application
To successfully embed and run the agent within the embedded chat, your application must meet the following requirements:
-
Include a server-side component (local or cloud-based)
A server is required to securely store and use private keys, sign requests, and interact with watsonx Orchestrate APIs. -
Include an HTML
rootcontainer
The embedding page must contain an HTML element with the IDroot. -
Use HTML strict mode
The page that embeds the web chat must declare HTML strict mode by including the<!DOCTYPE html>directive.
<body> tag to ensure that the DOM is available when the script runs, and that the root element can be resolved correctly at initialization time.Example implementation
The following is a minimal implementation example of a server and website running the web chat with security and authentication configured. This implementation uses NodeJS with the Express web application framework. The project uses the following folder structure:example-jwtRS256 keys with the following commands:
Using the chat APIs
Instance methods
Instance methods enable your code to interact with or modify an active chat instance at run time. They provide a way to programmatically control the behavior and state of the embedded chat component after it has been initialized based on user actions, application logic, or external events. For more information, see Instance methods.Events
Embedded web chat supports a variety of events that allow you to trigger specific actions or customize behavior. For more information, see Events.Agent completions API
You can also integrate your agent with external applications by using the ADK’s provided agent completions API. These APIs allow agents to be shared across multiple watsonx Orchestrate instances:- Orchestrate Native Runs API: For long-duration workflows. API Documentation:
- Chat Completions Compatibility Layer: OpenAI-compatible for easy integration. API Documentation:

