Skip to main content
An agent opens a native thread (Telegram forum topic, Discord thread, Slack thread) under a channel and posts a follow-up into it — falling back to the parent channel when the platform can’t thread.

Quick Start

1

Open a thread and post into it

2

Read the typed outcome


How It Works

create_thread resolves the target, checks the channel’s supports_threads capability, and dispatches to the adapter — returning a typed outcome instead of raising.

Status Decision Guide

Each call resolves to exactly one ThreadStatus — map it to the right caller action.
Progressive disclosure: start with the boolean result.ok, then branch on the four status values, then read the full ThreadResult dataclass when you need target, thread_id, or detail.

Configuration Options

ThreadResult (from praisonaiagents.gateway) is the typed return of every create_thread call. ThreadStatus is a string literal — one of the four values below. The capability flag lives on the adapter’s PlatformCapabilities.

Fallback Pattern

Try the thread, and route to the parent channel on any non-ok outcome.
Never raises. A channel that cannot thread returns a typed unsupported outcome — you do not need try/except around create_thread.

Authoring a Custom Adapter

A custom OutboundMessengerProtocol implementation declares the capability and returns a ThreadResult.

Per-Platform Support

Support tracks each adapter’s supports_threads capability.

Common Patterns

Scope a multi-agent subtask into its own thread so it doesn’t flood the shared channel.
Branch parallel workflow steps into separate threads, each falling back independently.

Best Practices

Send into f"{result.target}:{result.thread_id}" only when result.ok is True. On any other status, send to the parent target so the message still lands.
create_thread resolves to a typed unsupported / failed / no_route outcome instead of throwing. Branch on result.status, not on exceptions.
"no_route" means the target string didn’t resolve to a reachable channel — log it and fix the target rather than silently retrying.
Return PlatformCapabilities(supports_threads=True) and implement create_thread together. Declaring the capability without the method leaves the router returning unsupported.

Channel Capabilities

What each channel supports, including threads

Send Message Tool

Deliver messages and reactions to symbolic targets

Gateway

Gateway lifecycle predicates and exported symbols

Platform Capabilities

Per-adapter capability descriptor