# Adding Components

Source: https://langbot.app/docs/en/plugin/dev/components/add

Plugins consist of one or more components that provide different functionalities to LangBot. Currently supported component types include:

- Plugin processor (Runner): handles platform events in plugin code after an instance is created and bound. See the [tutorial](https://langbot.app/docs/en/plugin/dev/components/runner.md).
- Agent runner (Runner): provides execution logic selected in an Agent configuration; it is distinct from a standalone plugin processor.
- Event Listeners (EventListener): Listen to events during pipeline execution and modify context or pipelines.
- Commands (Command): Triggered by user command messages starting with `!` (or other configured prefixes).
- Tools (Tool): Called by LLMs during execution of LangBot's built-in Local Agent.
- Knowledge Engines (KnowledgeEngine): Provide knowledge base indexing and retrieval capabilities for LangBot, managing document ingestion, retrieval, and deletion.
- Parsers (Parser): Parse binary files such as PDF, Word, etc. into structured text before document ingestion, for use by Knowledge Engines.
- Pages (Page): Register custom visual pages in the LangBot WebUI sidebar, providing admin panels, data displays, and interactive interfaces.

## Adding Components

Execute the command in the plugin directory:

```bash
lbp comp <component_type>
```

For example, to add an event listener:

```bash
lbp comp EventListener
```

Follow the prompts to enter the component configuration (if any).

```bash
➜  HelloPlugin > lbp comp EventListener
Generating component EventListener...
Component EventListener generated successfully.
组件 EventListener 生成成功。
➜  HelloPlugin >
```

> :
>
> The CLI will generate a `components` directory in the plugin directory and create corresponding component directories within it.
>
> ```
> .
> ├── assets
> │   └── icon.svg
> ├── components
> │   ├── __init__.py
> │   └── event_listener
> │       ├── __init__.py
> │       ├── default.py
> │       └── default.yaml
> ├── main.py
> ├── manifest.yaml
> ├── README.md
> └── requirements.txt
> ```
>
> At the same time, component discovery configuration will be added to the plugin's `manifest.yaml`:
>
> ```yaml
> ...
> components:
>     EventListener:
>       fromDirs:
>       - path: components/event_listener/
> ...
> ```
>
> To remove components, you can delete the corresponding information manually.

## Component Types

For detailed usage of each component, please refer to:

- [Runner](https://langbot.app/docs/en/plugin/dev/components/runner.md)
- [EventListener](https://langbot.app/docs/en/plugin/dev/components/event-listener.md)
- [Command](https://langbot.app/docs/en/plugin/dev/components/command.md)
- [Tool](https://langbot.app/docs/en/plugin/dev/components/tool.md)
- [KnowledgeEngine](https://langbot.app/docs/en/plugin/dev/components/knowledge-engine.md)
- [Parser](https://langbot.app/docs/en/plugin/dev/components/parser.md)
- [Page](https://langbot.app/docs/en/plugin/dev/components/page.md)
