Skip to main content
The Page component allows plugins to register custom visual pages in the LangBot WebUI sidebar. Pages run inside an iframe sandbox, communicate with the host via the Page SDK, and can call the plugin’s backend API.

Use Cases

  • Admin panels: Provide visual configuration and data management interfaces (e.g., FAQ management, analytics dashboards)
  • Data displays: Show runtime statistics, logs, charts, etc.
  • Interactive tools: Provide forms, editors, and other interactive interfaces

Adding a Page Component

Run the following command in the plugin directory:
After entering the page name, the CLI will generate page files under components/pages/:
The plugin’s manifest.yaml will also be updated with the component discovery config:

Manifest File: Page

Backend Handler

The Page component’s backend handler extends the Page base class and implements handle_api to process API requests from the frontend page.

PageRequest Fields

PageResponse Construction

Frontend Page Development

Include the Page SDK in your HTML file to communicate with the plugin backend:

Page SDK API

Dark Mode

The SDK automatically sets CSS custom properties on the page. Use them directly:

Page i18n

Create an i18n/ directory inside your page directory with JSON translation files:
Translation files are flat JSON key-value pairs:
Add the data-i18n attribute to HTML elements for automatic translation:

Full Example: FAQ Manager

Here is a complete Page component example that implements CRUD operations for FAQ entries. Backend handler (components/pages/manager/manager.py):
Frontend page (components/pages/manager/index.html) calls the backend via langbot.api():
Full example code is available at FAQManager plugin.

Notes

  • Pages run inside a sandbox="allow-scripts allow-forms" iframe and cannot open popups or navigate the parent page
  • Access shared plugin state via self.plugin — Page and Tool components can share data
  • Use PageResponse.ok() and PageResponse.fail() to construct responses for consistent formatting
  • The Page SDK <script> tag must be placed before any code that uses the langbot object