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:{res.thread_id}” if res.ok else “slack:C123” await messenger.send(target, subtask_output)
Signature
async def create_thread(target: str, name: str) -> 'ThreadResult'Parameters
strSymbolic target token (“origin”, “<platform>”, or “<platform>:<chat_id>”, or a friendly alias).
strHuman-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 GitHubpraisonaiagents/gateway/protocols.py at line 3640