After creating a custom tool, you must add it to Optimizely Opal. Your tool must be hosted on a publicly accessible URL so Opal can connect to it.
You can host your tool yourself or use Optimizely Connect Platform (OCP), which provides integrated hosting and seamless deployment with the Optimizely ecosystem.
Host options
Self-host
You can host your tool on any platform with a public URL, including Vercel, Netlify, Amazon Web Services, Azure, Google Cloud Platform, or your own self-managed servers.
The only requirement is that your tool's /discovery endpoint is publicly accessible. See Deploy your self-hosted custom tool for steps to add your tool to Opal.
Host with OCP
OCP provides a managed environment for hosting custom tools. It simplifies deployment, handles infrastructure, and lets you publish your tool in the Optimizely App Directory.
In OCP, Opal tools are implemented as OCP Functions, which are event-driven services triggered by HTTP requests, usually from the Opal AI Assistant. You focus on your tool's logic while OCP manages scaling and reliability.
See Deploy your custom tool with OCP for steps.
Deploy your self-hosted custom tool
Initial configuration
Before adding your tool to Opal, ensure it has an HTTP endpoint (commonly /discovery) exposed. See Create custom tools for guidance.
Register your tool in Optimizely Opal
- Go to Tools > Registries in your Opal account.
-
Click Add tool registry.
- Enter a Registry Name.
- Enter your tool's discovery HTTP endpoint in the Discovery URL field.
- (Optional) Enter your authentication information in the Bearer Token (Optional) field if you configured custom bearer token authentication or OAuth for your tool.
-
Click Save.
Your Opal tools are now discoverable and available for use within Opal.
Deploy your custom tool in OCP
Prerequisites
- An OCP developer account.
- A configured OCP development environment, including the OCP Command Line Interface (CLI).
- An initialized Git repository for your Opal tool project.
- A completed Opal tool. See Create custom tools for instructions.
Project configuration
- Clone the Opal tool sample app GitHub repository or download its ZIP file.
-
Use the OCP CLI to register your application. Run the following command:
ocp app register
- Enter a unique App ID (use snake_case, no spaces).
- Enter a Display Name for your app.
- Select Connect Platform as the target product.
- Choose whether to make the app private or share it within your organization. Choose No if you intend to share it within your organization.
Configure and define your tool
- Open
app.ymlin your project's root directory. - Update
meta/app_idandmeta/display_nameto match the values you provided during registration. - Set
meta/vendor(you can find your vendor ID runningocp accounts whoami). - Add
meta/summary,meta/support_url, andmeta/contact_emailfor the OCP App Directory listing. -
Define your Opal Tool function under the
functionssection. Addingopal_tool: truemakes OCP display an extra section in app settings form that lets users register your app in Opal.functions: opal_tool: #A unique key for your function. entry_point: OpalToolFunction #The name of the class implementing your tool. description: Opal tool function #A brief description of this function. opal_tool: true #Lets users register your app in Opal.- The
entry_pointshould be the class name (for instance,OpalToolFunction) that contains your Opal Tool logic. This class must extend theFunctionclass from@zaiusinc/app-sdk(for TypeScript and JavaScript projects). - The
perform()method within yourentry_pointclass handles requests from Opal, including/discoveryfor tool metadata and specific tool execution endpoints (for example,/tools/greeting). - OCP functions support standard parameter types like string, integer, number, boolean, array, and object.
- The
-
Confirm your settings are correct before deploying your app by running the following command:
ocp app validate
Custom configuration and authorization
OCP provides secure ways to handle app-specific settings and authentication.
-
Custom settings – Define custom input fields in
forms/settings.xmlto let users configure your tool within the OCP App Directory UI. -
Authentication
-
Username and password
- Declare input fields (for example,
emailorapi_key) and an authorize button informs/settings.xml. - Implement validation in the
onFormSubmitmethod ofsrc/lifecycle/Lifecycle.ts. - Access stored credentials with
storage.settings.get().
- Declare input fields (for example,
-
OAuth
- Add an
oauth_buttontoforms/settings.xml. - Implement
onAuthorizationRequestandonAuthorizationGrantin yourLifecycleclass to manage the OAuth flow. - Access tokens should be stored and retrieved from OCP's secure secret storage using
storage.secrets.get().
- Add an
-
Username and password
OCP storage and secrets
OCP offers various storage types for your app.
- Secrets store – Stores sensitive information (for example, API keys or database credentials) that should not be exposed in settings forms.
- Settings store – Backs the settings form, which is suitable for non-sensitive configuration data.
- Key value store – Is a general-purpose storage for simple data structures (for example, lists or sets), high throughput, up to 400 KB per record.
- Shared key value store – Shares common data between app components.
Customize your app
Dependencies
You can add external libraries to your OCP app using your language's package manager (for example, npm install axios for Node.js).
Logs and notifications
- Use the
loggerfrom@zaiusinc/app-sdkfor logging events (info, warn, debug).- Logs are accessible in the OCP App Directory's Troubleshooting tab or through the ocp app logs command.
- Log levels can be changed with the
ocp app set-log-levelcommand. - See App logs and how to troubleshoot in the OCP documentation.
- Use
notificationsfrom@zaiusinc/app-sdkto send notifications to the OCP Activity Log.
App overview and assets
- Customize your app's presentation in the OCP App Directory by editing
directory/overview.md. - Replace
assets/logo.svgwith your own icon. You should use 150 x 50 pixels for the size.
Deploy to OCP
Before deploying, prepare your app for publication by running the following command:
ocp app prepare --bump-dev-version --publish
--bump-dev-version flag increases the app version in app.yml for upgrades.Install your app to the sandbox OCP account by running the following command:
ocp directory install <YOUR_APP_ID>@<YOUR_APP_VERSION> <PUBLIC_API_KEY>
- <YOUR_APP_ID> and <YOUR_APP_VERSION> are from your
app.ymlor theocp app preparecalls output. - <PUBLIC_API_KEY> can be found in your OCP UI (Settings > APIs) or by running
ocp accounts whoami.
Register your tool in Optimizely Opal
After your OCP app is deployed and running, users can now add your app to Opal.
If you use Opti ID, administrators can turn off generative AI in the Opti ID Admin Center. See Turn generative AI off across Optimizely applications.
Article is closed for comments.