Skip to main content

create_thread

AsyncMethod
This is a method of the OutboundMessengerProtocol class in the protocols module.
Open a new thread/topic under target (Issue #3987). For multi-agent handoffs, subtasks, and parallel workflow branches, this lets the gateway scope a subtask into its own platform-native thread (Telegram forum topic, Discord thread, Slack thread anchor) instead of flooding the shared channel inline. Gated on the channel’s PlatformCapabilities.supports_threads — a channel that cannot thread returns a typed unsupported outcome instead of raising, so the caller falls back to the parent channel:: res = await messenger.create_thread(“slack:C123”, name=“research”) target = f”slack:C123:{res.thread_id}” if res.ok else “slack:C123” await messenger.send(target, subtask_output)

Signature

Parameters

str
required
Symbolic target token (“origin”, “<platform>”, or “<platform>:<chat_id>”, or a friendly alias).
str
required
Human-friendly thread/topic title.

Returns

'ThreadResult'
class:ThreadResult carrying the new thread id on success, or a typed unsupported / failed / no_route outcome. Never raises.

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 2653