Skip to main content
LangBot provides a series of APIs for plugins to operate various LangBot modules and control message contexts.

Request API

Operations for the currently processing user request (message). Only available in EventListener and Command components. Access methods:
  • In event handler methods of EventListener: Internal methods of event_context: context.EventContext object
  • In subcommand handler methods of Command: Internal methods of context: ExecuteContext object

Direct Reply Message

Directly reply with a message chain to the session where the current request is located. For message chain construction methods, please refer to Message Platform Entities.

Get Bot UUID

Get the UUID of the bot that originated the current request.

Set Request Variables

Some information in a single request is stored in request variables. When using external Agent platforms like Dify, these variables are explicitly passed to Agent platforms.

Get Request Variables

Get a single request variable.

Get All Request Variables

List Pipeline Knowledge Bases

Get the list of knowledge bases configured for the pipeline used by the current request.
Only returns knowledge bases bound in the Local Agent configuration of the pipeline corresponding to the current request. If the current pipeline has no knowledge bases configured, or does not use Local Agent, an empty list is returned.

LangBot API

These APIs can be called in any plugin component. Access methods:
  • In the plugin root directory main.py: Internal methods of the self object, these APIs are all provided by the plugin class parent class BasePlugin.
  • In any plugin component class: Internal methods of the self.plugin object.

Get Plugin Configuration

Plugin configuration format can be written in manifest.yaml, and users need to fill it out according to the plugin configuration format in LangBot’s plugin management. Plugin code can then call this API to get plugin configuration information.

Get LangBot Version

Get the LangBot version number, returned as a string in format v<major>.<minor>.<patch>.

Get Configured Bot List

Returns a list of all bot UUIDs.

Get Bot Information

Get bot information.

Send Proactive Message

Send proactive messages through bot UUID and target session ID. For message chain construction methods, please refer to Message Platform Entities.

Get Configured LLM Model List

Returns a list of UUIDs for all configured LLM models.

Invoke LLM Model

Invoke an LLM model, returns an LLM message. Non-streaming.

List Available Parsers

List Parser plugins currently available on the host, optionally filtered by MIME type.

List All Available Tools

List all available tools in the current LangBot instance (including plugin tools and MCP tools).

Get Tool Detail

Get detailed information about a specific tool.

Call Tool

Call a specific tool.
Tool names use metadata.name (e.g. echo_tool, get_weather_alerts), without author or plugin name prefix.

Set Plugin Persistent Data

Persistently store plugin data. Data stored through this interface can only be accessed by this plugin. Values need to be converted to bytes manually.

Get Plugin Persistent Data

Get All Plugin Persistent Data Keys

Delete Plugin Persistent Data

Get Workspace Persistent Data

Data stored through this interface can be accessed by all plugins. Values need to be converted to bytes manually.

Get Workspace Persistent Data

Get All Workspace Persistent Data Keys

Delete Workspace Persistent Data

Get Plugin File-typed Config Field Data

Use this in conjunction with configuration fields of type file or array[file.

Knowledge Base API

These APIs are accessible via self.plugin in any component, allowing you to list and retrieve from all knowledge bases in the LangBot instance without pipeline restrictions.

List All Knowledge Bases

List all available knowledge bases in the LangBot instance.

Retrieve from Knowledge Base

Retrieve relevant documents from any knowledge base.
These APIs do not require a query_id and can be used in any component (including Tool components). They can access all knowledge bases without being restricted to the current pipeline’s configuration.

RAG API

These APIs are available for KnowledgeEngine components to access the LangBot host’s embedding models, vector database, and file storage. Access method:
  • In KnowledgeEngine component classes: Internal methods of the self.plugin object.

Invoke Embedding Model

Generate text embeddings using the host’s configured embedding model.

Vector Upsert

Upsert vectors to the host’s vector database.
Search similar vectors in the host’s vector database.
Each result returned by vector_search is a dict containing id (vector ID), score (distance score), and metadata (metadata provided during upsert). If you need text content in retrieval results, store the text in metadata during ingestion.

Vector Delete

Delete vectors from the host’s vector database.
The filters parameter supports Chroma-style where syntax for metadata filtering. Multiple top-level keys are AND-ed. Supported operators: $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin.
Note: Chroma, Qdrant, and SeekDB store full metadata and can filter on any field. Milvus and pgvector only store text, file_id, and chunk_uuid — filters on other fields will be silently ignored.
Get uploaded file content from the host’s storage.