Create Thread • AI Agent SDK

create_thread: Open a new thread/topic under “target“ (Issue #3987).

create_thread

Async

Method

</div>

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:&#123;res.thread_id&#125;” if res.ok else “slack:C123” await messenger.send(target, subtask_output)

Signature

python
async def create_thread(target: str, name: str) -> 'ThreadResult'

Parameters

ParamField str

Symbolic target token (“origin”, “&lt;platform&gt;”, or “&lt;platform&gt;:&lt;chat_id&gt;”, or a friendly alias).

ParamField str

Human-friendly thread/topic title.

Returns

ResponseField '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 3640