Skip to main content

Dynamic Panels

Not every custom UI needs to be a separate application. Codebolt can render runtime UI panels inside the existing app through the dynamic panel system.

Dynamic panels are driven by agents or plugins — they open a panel, send it data, and listen for user interactions. This is different from a custom UI, which is a standalone app that owns the entire UX.

How It Works

Dynamic panel architecture: Codebolt app renders the panel iframe while the server and agent or plugin exchange messages with itInside The Existing Codebolt AppCodebolt AppThe host app owns layout, tabs, panels, and iframe mounting.Chat / Existing UInormal app surfacesagent runor plugin actionDynamic PanelHTML rendered in an iframe inside the app.UI contentforms, charts, controlscodeboltPluginsendMessage / onMessagepanel messaging APISocket.IO eventspanel data + repliesServerRegisters panels, routes messages, and resolves wait-for-response flows.DynamicPanelServiceopen, update, close, listagent APIcodebolt.dynamicPanelplugin APIplugin.dynamicPanelcommands + callbacksOriginating Agent Or Plugin
  1. An agent or plugin opens a panel with HTML content.
  2. The server registers the panel and emits a Socket.IO event to the UI.
  3. The UI renders the panel in the specified position.
  4. Messages flow bidirectionally between the panel and the originating agent/plugin.
  5. Cleanup happens automatically when the agent/plugin disconnects.

Panel Interface

interface DynamicPanelOptions {
panelId: string; // Unique identifier
title: string; // Panel title bar text
html: string; // HTML content to render
position?: 'left' | 'right' | 'bottom' | 'center'; // default: 'right'
width?: number; // Panel width
height?: number; // Panel height
waitForResponse?: boolean; // Block until user responds
timeout?: number; // Timeout for waitForResponse (ms)
}

Supported Actions

ActionDescription
dynamicPanel.openCreate and display a new panel
dynamicPanel.updateUpdate an existing panel's content or title
dynamicPanel.closeClose and remove a panel
dynamicPanel.sendSend a message to the panel
dynamicPanel.listList all active panels

From an Agent

Agents use the codebolt.dynamicPanel API:

// Open a panel
await codebolt.dynamicPanel.open({
panelId: 'my-review-panel',
title: 'Code Review',
html: '<div id="review">Loading...</div>',
position: 'right',
});

// Update content
codebolt.dynamicPanel.update({
panelId: 'my-review-panel',
html: '<div id="review"><h2>3 issues found</h2>...</div>',
});

// Listen for user interactions
codebolt.dynamicPanel.onMessage('my-review-panel', (msg) => {
if (msg.type === 'approve') {
// User approved the review
}
});

// Close when done
codebolt.dynamicPanel.close('my-review-panel');

Request/Response Pattern

Use waitForResponse to block the agent until the user interacts:

const response = await codebolt.dynamicPanel.open({
panelId: 'confirm-deploy',
title: 'Confirm Deployment',
html: `
<div>
<p>Deploy to production?</p>
<button onclick="respond({ type: 'confirm' })">Yes</button>
<button onclick="respond({ type: 'cancel' })">No</button>
</div>
`,
waitForResponse: true,
timeout: 30000,
});

if (response?.type === 'confirm') {
// proceed with deployment
}

From a Plugin

Plugins declare a UI HTML file in package.json and communicate with it through the Plugin SDK.

Plugin SDK API

MethodDirectionDescription
plugin.dynamicPanel.send(panelId, data)Plugin → PanelSend a JSON message to the panel
plugin.dynamicPanel.onMessage(panelId, handler)Panel → PluginListen for messages from the panel
plugin.dynamicPanel.offMessage(panelId)Remove the message handler
plugin.dynamicPanel.list()List all active panels

Client-Side API (inside panel HTML)

Codebolt injects a global codeboltPlugin object into your panel HTML:

MethodDirectionDescription
codeboltPlugin.sendMessage(data)Panel → PluginSend a JSON message to the plugin backend
codeboltPlugin.onMessage(handler)Plugin → PanelListen for messages from the plugin backend

For a complete step-by-step walkthrough of building a plugin with a dynamic panel, see Build Your First Dynamic Panel.

Use Cases

Use caseExample
Focused UI during a runShow a progress dashboard while an agent works
Human-in-the-loopConfirmation dialogs, form inputs, review approvals
Rich interactive viewsCharts, tables, or visualizations beyond plain chat
Settings panelsPlugin configuration UI
MonitoringReal-time agent activity or system metrics

Dynamic Panels vs Custom UI

Use dynamic panels whenUse a custom UI when
UI should live inside the existing Codebolt appYou want to own the whole product surface
Interaction is tied to one agent run or one pluginUI runs outside the existing desktop/web app
You want to augment the built-in appYou need your own routing, branding, or shell

See Also