mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-10-29 20:05:25 +08:00
docs(runner): explain processor configurations and bot subscriptions
This commit is contained in:
@@ -159,7 +159,7 @@ event_type = ctx.event.event_type
|
||||
| `context` | `ContextAccess` | Conversation cursors, inline policy, and available context APIs |
|
||||
| `state` | `AgentRunState` | Scope-specific state snapshot loaded at the start of the run |
|
||||
| `runtime` | `AgentRuntimeContext` | LangBot version, trace ID, and deadline |
|
||||
| `config` | `dict[str, Any]` | Current Agent or plugin-processor instance configuration |
|
||||
| `config` | `dict[str, Any]` | Current Agent or plugin-processor configuration |
|
||||
| `adapter` | `AdapterContext \| None` | Additional entry-adapter data |
|
||||
| `metadata` | `dict[str, Any]` | Other metadata supplied by the Host |
|
||||
|
||||
|
||||
@@ -186,12 +186,14 @@ Configure the debug connection following the [plugin development tutorial](/en/p
|
||||
|
||||
Platform replies use Mock during debugging and send no real messages. Restart `lbp run` after editing component YAML.
|
||||
|
||||
After installing the plugin, bind the Bot's **Member joined** and **Message received** events to this processor to handle actual events.
|
||||
After installing the plugin, add this configuration under **Plugin processor** on the bot detail page and save. You can also select a component, fill in its configuration, and create and bind a new configuration directly there. Declared events are delivered automatically; no per-event routes are needed.
|
||||
|
||||
Plugin subscriptions run independently of Agent/Pipeline routes. An event can trigger multiple processors, and one failure does not prevent the others from running. Bots using the same configuration share settings and runtime state; create separate configurations for different settings. Expose optional behavior, such as replies, through component configuration to avoid duplicate responses.
|
||||
|
||||
## Next Steps
|
||||
|
||||
- See the [`RunnerContext` API reference](/en/plugin/dev/apis/agent-run#runner).
|
||||
- See [LangBot API](/en/plugin/dev/apis/common) for models, tools, knowledge bases, and storage.
|
||||
- See [Platform API](/en/plugin/dev/apis/platform) for messaging and other platform operations.
|
||||
- Explore more examples in [RunnerDemo](https://github.com/langbot-app/langbot-plugin-demo/tree/main/RunnerDemo).
|
||||
- Explore more examples in [RunnerDemo](https://github.com/langbot-app/langbot-plugin-demo/tree/main/Runner/RunnerDemo).
|
||||
- To extend Pipeline steps such as preprocessing or completion of a model call, use [Event Listener](/en/plugin/dev/components/event-listener).
|
||||
|
||||
@@ -159,7 +159,7 @@ event_type = ctx.event.event_type
|
||||
| `context` | `ContextAccess` | 会話カーソル、インライン方針、利用可能なコンテキスト API |
|
||||
| `state` | `AgentRunState` | 実行開始時に読み込まれたスコープ別状態のスナップショット |
|
||||
| `runtime` | `AgentRuntimeContext` | LangBot バージョン、トレース ID、期限 |
|
||||
| `config` | `dict[str, Any]` | 現在の Agent またはプラグイン処理インスタンスの設定 |
|
||||
| `config` | `dict[str, Any]` | 現在の Agent またはプラグインプロセッサーの設定 |
|
||||
| `adapter` | `AdapterContext \| None` | エントリーアダプターの追加データ |
|
||||
| `metadata` | `dict[str, Any]` | ホストが提供するその他のメタデータ |
|
||||
|
||||
@@ -183,7 +183,7 @@ event_type = ctx.event.event_type
|
||||
| `await ctx.get_available_tools()` | `list[dict[str, Any]]` | 今回呼び出せるコンテキスト操作、プラットフォーム API、プラグインツール、MCP ツールを取得 |
|
||||
| `await ctx.call_tool(tool_name, parameters=None)` | `dict[str, Any]` | 上記一覧のツールを呼び出す |
|
||||
|
||||
`get_available_tools()` の各項目には `name`、`description`、`parameters`、`type`、`operations` が含まれます。結果は現在の Agent またはプラグイン処理インスタンスの設定とイベント機能で絞り込まれています。一覧にないツールは `ctx.call_tool()` で呼び出せません。
|
||||
`get_available_tools()` の各項目には `name`、`description`、`parameters`、`type`、`operations` が含まれます。結果は現在の Agent またはプラグインプロセッサーの設定とイベント機能で絞り込まれています。一覧にないツールは `ctx.call_tool()` で呼び出せません。
|
||||
|
||||
### プロンプト、履歴、イベント
|
||||
|
||||
|
||||
@@ -186,12 +186,14 @@ async with ctx.reply_stream() as reply:
|
||||
|
||||
デバッグ中の返信は Mock で再現され、実際のメッセージは送信されません。コンポーネントの YAML を変更したら `lbp run` を再起動してください。
|
||||
|
||||
インストール後、Bot のメンバー参加とメッセージ受信をこのプロセッサーに紐付けると、実際のイベントを処理できます。
|
||||
インストール後、ボット詳細の「プラグインプロセッサー」でこの設定を追加して保存します。この画面でコンポーネントを選択し、設定を入力して新規作成・紐付けすることもできます。宣言されたイベントは自動で配信され、イベントごとのルート設定は不要です。
|
||||
|
||||
プラグインの購読は Agent/パイプラインのルートと独立して実行されます。同じイベントを複数のプロセッサーが処理でき、一つが失敗しても他の実行を妨げません。同じ設定を使用するボットは設定内容と実行状態を共有します。個別に設定する場合は、新しい設定を作成してください。返信などの任意の動作はコンポーネントの設定として提供し、重複返信を避けてください。
|
||||
|
||||
## 次のステップ
|
||||
|
||||
- [`RunnerContext` API リファレンス](/ja/plugin/dev/apis/agent-run#runner)を確認します。
|
||||
- モデル、ツール、ナレッジベース、ストレージについては [LangBot API](/ja/plugin/dev/apis/common)を確認します。
|
||||
- メッセージ送信などについては[プラットフォーム API](/ja/plugin/dev/apis/platform)を確認します。
|
||||
- [RunnerDemo](https://github.com/langbot-app/langbot-plugin-demo/tree/main/RunnerDemo)で他の実装例を確認できます。
|
||||
- [RunnerDemo](https://github.com/langbot-app/langbot-plugin-demo/tree/main/Runner/RunnerDemo)で他の実装例を確認できます。
|
||||
- パイプラインの前処理やモデル呼び出し完了時などに機能を追加する場合は、[イベントリスナー](/ja/plugin/dev/components/event-listener)を使用してください。
|
||||
|
||||
@@ -161,7 +161,7 @@ event_type = ctx.event.event_type
|
||||
| `context` | `ContextAccess` | 会话游标、内联范围和可用上下文 API |
|
||||
| `state` | `AgentRunState` | 本次运行开始时读取到的各作用域状态快照 |
|
||||
| `runtime` | `AgentRuntimeContext` | LangBot 版本、追踪 ID 和截止时间 |
|
||||
| `config` | `dict[str, Any]` | 当前 Agent 或插件处理器实例配置 |
|
||||
| `config` | `dict[str, Any]` | 当前 Agent 或插件处理器配置 |
|
||||
| `adapter` | `AdapterContext \| None` | 入口适配器附加数据 |
|
||||
| `metadata` | `dict[str, Any]` | 宿主提供的其他元数据 |
|
||||
|
||||
|
||||
@@ -186,12 +186,14 @@ async with ctx.reply_stream() as reply:
|
||||
|
||||
调试中的平台回复使用 Mock,不发送真实消息。修改组件 YAML 后,请重启 `lbp run`。
|
||||
|
||||
安装插件后,在机器人中将「成员加入群组」和「收到消息」绑定到该处理器,即可处理实际事件。
|
||||
安装插件后,在机器人详情页的「插件处理器」中添加该配置并保存。也可以直接在这里选择组件、填写配置,创建并绑定新配置。机器人会自动投递组件声明的事件,无需逐条配置事件路由。
|
||||
|
||||
插件处理器与 Agent/流水线路由独立执行,同一事件可以触发多个插件处理器,某个处理器失败不会阻止其他处理。使用同一配置的机器人会共享设置和运行状态;需要分别设置时,创建不同的配置。可选功能应通过组件配置提供,例如是否回复消息,避免与其他处理器重复回复。
|
||||
|
||||
## 接下来做什么
|
||||
|
||||
- 查看 [`RunnerContext` 上下文 API](/zh/plugin/dev/apis/agent-run#runner)。
|
||||
- 查看模型、工具、知识库和存储相关的 [LangBot API](/zh/plugin/dev/apis/common)。
|
||||
- 查看消息发送等[平台 API](/zh/plugin/dev/apis/platform)。
|
||||
- 查看 [RunnerDemo](https://github.com/langbot-app/langbot-plugin-demo/tree/main/RunnerDemo) 中的更多示例。
|
||||
- 查看 [RunnerDemo](https://github.com/langbot-app/langbot-plugin-demo/tree/main/Runner/RunnerDemo) 中的更多示例。
|
||||
- 如果要扩展流水线的预处理、模型调用完成等步骤,请使用[事件监听器](/zh/plugin/dev/components/event-listener)。
|
||||
|
||||
Reference in New Issue
Block a user