Skip to content

Commit edaebe1

Browse files
committed
docs: add documentation for chat surface adapters in Agent plugin
1 parent 4c43e47 commit edaebe1

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

  • adminforth/documentation/docs/tutorial/08-Plugins

adminforth/documentation/docs/tutorial/08-Plugins/01-agent.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,36 @@ Each item in `modes` defines a user-selectable preset in the chat UI. The select
284284

285285
The plugin adds a chat surface to the admin UI, keeps session history per admin user, and shows a mode picker when `modes` are configured.
286286

287+
## Chat surfaces (Telegram, etc.)
288+
289+
By default, the Agent plugin exposes a chat surface inside the AdminForth admin UI.
290+
If you want to talk to the same agent from external chat products (Telegram, etc.), connect a **chat surface adapter**.
291+
292+
The adapter is registered in the plugin config via `chatSurfaceAdapters` and the plugin exposes an HTTP webhook endpoint for it.
293+
294+
Example (Telegram):
295+
296+
```ts
297+
import AdminForthAgent from '@adminforth/agent';
298+
import TelegramChatSurfaceAdapter from '@adminforth/chat-surface-adapter-telegram';
299+
300+
new AdminForthAgent({
301+
// ...modes, sessionResource, turnResource, etc.
302+
chatSurfaceAdapters: [
303+
new TelegramChatSurfaceAdapter({
304+
botToken: process.env.TELEGRAM_BOT_TOKEN as string,
305+
webhookSecret: process.env.TELEGRAM_WEBHOOK_SECRET,
306+
// optional
307+
adminUserTelegramIdField: 'telegramId',
308+
}),
309+
],
310+
});
311+
```
312+
313+
Next steps (Telegram bot setup, webhook URL, required `telegramId` field on the admin user resource, and all adapter options) are documented here:
314+
315+
- Telegram Chat Surface Adapter: `/docs/tutorial/Adapters/chat-surface-adapter-telegram`
316+
287317
## Debugging agent turns
288318

289319
Agent debug traces are optional and are intended for auditability and debugging. When enabled, they let you reconstruct why an agent produced a response or made a change by storing the full execution sequence for the turn: LLM steps, tool calls, tool inputs and outputs, token usage, and cache information.

0 commit comments

Comments
 (0)