Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

@elizaos/plugin-tlon

Tlon/Urbit integration plugin for elizaOS agents. This plugin enables agents to communicate via the Urbit network using the Tlon messaging protocol.

Features

  • Direct Messages (DMs): Send and receive direct messages with other Urbit ships
  • Group Channels: Participate in group chat channels
  • Thread Replies: Reply to specific messages in threads
  • Real-time Streaming: SSE-based real-time message streaming
  • Channel Authorization: Control which ships can interact with your agent
  • Auto-discovery: Automatically discover available channels

Installation

# TypeScript
npm install @elizaos/plugin-tlon

# Python
pip install elizaos-plugin-tlon

# Rust
cargo add elizaos-plugin-tlon

Configuration

Environment Variables

Variable Required Description
TLON_SHIP Yes Your Urbit ship name (e.g., ~sampel-palnet)
TLON_URL Yes URL of your Urbit ship's HTTP API
TLON_CODE Yes Authentication code from +code in dojo
TLON_ENABLED No Enable/disable the plugin (default: true)
TLON_GROUP_CHANNELS No JSON array of channel nests to monitor
TLON_DM_ALLOWLIST No JSON array of ships allowed to send DMs
TLON_AUTO_DISCOVER_CHANNELS No Auto-discover channels (default: true)

Example Configuration

TLON_SHIP=~sampel-palnet
TLON_URL=https://sampel-palnet.tlon.network
TLON_CODE=lidlut-tabwed-pillex-ridrup
TLON_ENABLED=true
TLON_GROUP_CHANNELS=["chat/~host-ship/channel-name"]
TLON_DM_ALLOWLIST=["~zod", "~bus"]
TLON_AUTO_DISCOVER_CHANNELS=true

Usage

TypeScript

import tlonPlugin, { TlonService } from '@elizaos/plugin-tlon';

// Add to your agent's plugins
const agent = {
  plugins: [tlonPlugin],
  // ...
};

// Or use the service directly
const service = new TlonService(runtime);
await TlonService.start(runtime);

// Send a DM
await service.sendDirectMessage('~sampel-palnet', 'Hello from my agent!');

// Send a channel message
await service.sendChannelMessage(
  'chat/~host-ship/channel-name',
  'Hello channel!',
  'optional-reply-to-id'
);

Python

from elizaos_plugin_tlon import TlonService, TlonConfig

# Create configuration
config = TlonConfig.from_env()

# Or configure manually
config = TlonConfig(
    ship="sampel-palnet",
    url="https://sampel-palnet.tlon.network",
    code="lidlut-tabwed-pillex-ridrup",
)

# Start the service
service = TlonService(config)
await service.start()

# Send messages
await service.send_dm("~other-ship", "Hello!")
await service.send_channel_message("chat/~host/channel", "Hello channel!")

# Register message handlers
@service.on_message
def handle_message(payload):
    print(f"Received: {payload.text} from {payload.from_ship.name}")

Rust

use elizaos_plugin_tlon::{TlonConfig, TlonService};

// Create configuration
let config = TlonConfig::from_env()?;

// Or configure manually
let config = TlonConfig::new(
    "sampel-palnet".to_string(),
    "https://sampel-palnet.tlon.network".to_string(),
    "lidlut-tabwed-pillex-ridrup".to_string(),
);

// Start the service
let mut service = TlonService::new(config);
service.start().await?;

// Send messages
service.send_dm("other-ship", "Hello!").await?;
service.send_channel_message("chat/~host/channel", "Hello!", None).await?;

Urbit Concepts

Ships

Urbit ships are identified by their @p names, which look like ~sampel-palnet. Ships can be:

  • Galaxies: 8-bit names like ~zod
  • Stars: 16-bit names like ~marzod
  • Planets: 32-bit names like ~sampel-palnet
  • Moons: 64-bit names derived from planets

Channels

Tlon organizes messages into channels. Channel nests follow the format:

<type>/<host-ship>/<channel-name>

For example: chat/~sampel-palnet/general

Authentication

To get your authentication code:

  1. Open your ship's dojo
  2. Run +code
  3. Copy the resulting code (e.g., lidlut-tabwed-pillex-ridrup)

API Reference

TlonService

The main service class for interacting with Tlon/Urbit.

Methods

  • start() - Start the service and connect to the Urbit ship
  • stop() - Stop the service and disconnect
  • sendDirectMessage(ship, text) - Send a DM to a ship
  • sendChannelMessage(channelNest, text, replyToId?) - Send a message to a channel
  • isConnected() - Check if the service is connected

TlonClient

Lower-level HTTP API client for direct Urbit interaction.

Methods

  • authenticate(url, code) - Authenticate with a ship
  • subscribe(params) - Subscribe to an app's path
  • poke(params) - Send a poke to an app
  • scry(path) - Perform a read-only query
  • connect() - Connect and start receiving events
  • close() - Close the connection

Events

The plugin emits the following events:

Event Description
TLON_WORLD_CONNECTED Successfully connected to ship
TLON_WORLD_LEFT Disconnected from ship
TLON_MESSAGE_RECEIVED Any message received
TLON_DM_RECEIVED Direct message received
TLON_GROUP_MESSAGE_RECEIVED Group channel message received
TLON_CONNECTION_ERROR Connection error occurred
TLON_RECONNECTED Successfully reconnected

Development

# Build all implementations
npm run build

# Run tests
npm run test

# TypeScript only
npm run build:ts
npm run test:ts

# Rust only
npm run build:rust
npm run test:rust

# Python only
npm run build:python
npm run test:python

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

elizaos_plugin_tlon-2.0.0a5.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

elizaos_plugin_tlon-2.0.0a5-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file elizaos_plugin_tlon-2.0.0a5.tar.gz.

File metadata

  • Download URL: elizaos_plugin_tlon-2.0.0a5.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for elizaos_plugin_tlon-2.0.0a5.tar.gz
Algorithm Hash digest
SHA256 fa99afc3b24c36a818be8229afee39b8d4569711669ff016bcf401cbd7ea07e3
MD5 e067544229a577e7d4f83364a3474aff
BLAKE2b-256 92085d90278399fee02ccb9e9874bd02922db49b1d48ca97ba91a428119d223d

See more details on using hashes here.

File details

Details for the file elizaos_plugin_tlon-2.0.0a5-py3-none-any.whl.

File metadata

File hashes

Hashes for elizaos_plugin_tlon-2.0.0a5-py3-none-any.whl
Algorithm Hash digest
SHA256 4de13f5ea1f96d9afacfa38f68802366772b05dfab333351551a1104681904b8
MD5 7da1772e04a116a67ba26ef831b42ef4
BLAKE2b-256 1f7b9a32407940725f93914924a9d5d0e1a6b8ef7fe187dca1246d40386d717b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.0.0a5 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page