This directory contains example code and configurations demonstrating how to use Dexto in various contexts.
The simplest example of how to use the Dexto Agent SDK. Shows:
- Creating an agent with minimal configuration
- Starting and stopping the agent
- Creating a session
- Using
generate()for request/response interactions - Token usage tracking
Run it with:
npx tsx basic-agent-example.tsShows how to integrate Dexto with LangChain, useful if you're already using LangChain in your project.
Demonstrates using the AgentManager API for managing multiple agents programmatically.
Shows a pattern for implementing a multi-agent coordinator/specialist architecture where one agent delegates tasks to specialized agents.
A simple HTTP server example demonstrating Dexto's resource authorization flow.
See the /agents/ directory for YAML configuration examples for different use cases.
- Copy an example to your project or workspace
- Customize the configuration for your needs
- Install dependencies if it has a
package.json - Follow the README for setup and running instructions
Each example is self-contained and can be run independently.
These examples show how to integrate DextoAgent with different messaging platforms. They are reference implementations that you can customize and extend for your own use cases.
A complete Discord bot integration using discord.js and the Discord Gateway API.
Features:
- Responds to messages in DMs and server channels
- Support for the
!askcommand prefix in channels - Image attachment processing
- Rate limiting per user
- Persistent per-user conversation sessions
- Tool call notifications
Quick Start:
cd discord-bot
pnpm install
cp .env.example .env
# Add your DISCORD_BOT_TOKEN to .env
pnpm startSee: discord-bot/README.md for detailed setup and usage instructions.
A complete Telegram bot integration using grammy and the Telegram Bot API.
Features:
- Responds to messages in DMs and group chats
- Support for
/askcommand and/startmenu - Image attachment processing
- Inline query support (use bot username in any chat)
- Session reset button
- Concurrency control for inline queries
- Persistent per-user conversation sessions
- Tool call notifications
Quick Start:
cd telegram-bot
pnpm install
cp .env.example .env
# Add your TELEGRAM_BOT_TOKEN to .env
pnpm startSee: telegram-bot/README.md for detailed setup and usage instructions.
To build your own platform integration:
- Start with a reference implementation - Use
discord-botortelegram-botas a template - Adapt the bot.ts - Replace platform-specific code with your target platform's SDK
- Keep the pattern - Receive a pre-initialized DextoAgent and implement platform-specific I/O
- Reuse the config - Use the same agent-config.yml pattern for configuration
- Add main.ts - Create a standalone runner that initializes the agent and starts your bot
The key pattern is:
export function startMyBot(agent: DextoAgent) {
// Platform-specific setup
// Use agent.run() to process user input
// Use agent.on() to listen for events
// Return your platform's client/connection object
}MIT