Skip to main content
An Interface connects a Definable agent to an external messaging platform — Telegram, Discord, Slack, voice phone calls, Desktop, CLI, or any custom channel. It handles the full lifecycle: receiving messages, managing sessions, resolving user identity, running the agent, and sending responses back.

How It Works

Every incoming message flows through a structured pipeline: Concurrency is controlled by a semaphore — multiple messages can be processed in parallel up to max_concurrent_requests. Errors at any step trigger on_error hooks and send a configurable error message to the user.

Quick Example

Deploy an agent to Telegram in a few lines:
That is all it takes. The interface handles session management, conversation history, media, and concurrent users automatically.

Lifecycle

Starting

Stopping

The interface shuts down gracefully on KeyboardInterrupt or when stop() is called. All active connections and resources are cleaned up.

BaseInterface Constructor

All interfaces accept these parameters:
Agent
required
The Definable agent that processes messages.
Any
Platform-specific parameters passed directly (e.g., bot_token, mode, allowed_user_ids). See each interface’s reference for available parameters.
SessionManager
Custom session manager. A default one is created if not provided.
List[InterfaceHook]
List of hooks to attach. Can also be added later with .add_hook().
IdentityResolver
Cross-platform identity resolver. Maps platform user IDs to canonical user IDs for shared memory. See Identity Resolution.

Common Parameters

All interfaces accept these base parameters as keyword arguments:

Adding Hooks

Chain hooks with .add_hook():

Key Concepts

Sessions

Automatic per-user session management with history, state, and TTL expiry.

Hooks

Intercept messages and responses with composable hook functions.

Telegram

Deploy to Telegram with polling or webhooks, media support, and access control.

Discord

Deploy to Discord with guild/DM support, attachments, and access control.

Slack

Deploy to Slack with Socket Mode, Block Kit interactions, and slash commands.

WebSocket

Real-time bidirectional communication via JSON WebSocket protocol.

WhatsApp

Connect to WhatsApp via the Twilio WhatsApp API.

Email

IMAP polling + SMTP sending with thread tracking.

Call (Voice)

Voice calls via Twilio ConversationRelay.

Identity

Map users across platforms to a single canonical identity.

Multi-Interface

Run multiple interfaces concurrently with automatic restart.

Custom Interfaces

Build your own interface for any messaging platform.

Usage Examples

Telegram Bot

Step-by-step: agent with tools, memory, and voice notes.

Discord Bot

Step-by-step: agent with tools and persistent memory.

Slack Bot

Step-by-step: agent with tools and slash commands.

Multi-Platform

Serve one agent across Telegram, Discord, and Slack.