Prompt
Pipeline: take our latest podcast transcript, find the most quotable moment, and call draft_post for threads with a short post quoting it and linking the episode example.com/podcast/57. Under 400 characters. How to do it
- Mint a Threads agent key In https://app.socialhandoff.com, open Connections, connect your Threads account, then create an agent key scoped to Threads with draft permission only. Copy the key when it is shown; only its hash is stored.
- Install the MCP adapter Add langchain-mcp-adapters and create a MultiServerMCPClient with a streamable_http connection to https://app.socialhandoff.com/mcp and a bearer header.
- Load tools into the agent Call get_tools() and pass them to your agent. Keep the key scoped to Threads and draft so the model only sees what it needs.
- Run the pipeline Feed the chain its source material, let it call draft_post for Threads, and read the returned post id. Or skip MCP and POST to /v1/posts from a plain tool.
Example draft
"The best onboarding email I ever sent had no links in it. It just asked what they were trying to get done." From this week's episode with a founder who grew to 10k users on a support inbox and a spreadsheet. Listen: example.com/podcast/57
Gotchas
- A draft too long for one post can go out as a reply-chain thread, with each part published as a reply to the one before. Every part has its own 500-character limit, and a carousel of 2 to 20 images or videos can lead the chain.
- Threads allows 250 posts per account in any 24 hours. The quota is checked before each publish, so a post that would go over it is stopped before it is sent rather than failing at the network.
- Threads fetches images and video from your instance at signed, expiring URLs, so you do not need a separate public media host. The API itself must be reachable over public HTTPS; an instance that only runs on localhost cannot publish media to Threads.
- The adapter loads every tool the key allows. Scope the key to Threads and draft permission so the model cannot reach analytics or scheduling tools you did not plan for.
- Character limit: 500 characters per post. Emoji count as their UTF-8 bytes, so an emoji can use up to 4 characters of the limit.
- Links: Up to 5 links per post. Threads generates a preview for the first one.
- Carousels: 2 to 20 images or videos in one carousel post.
- Image files: JPEG or PNG, up to 8 MB. Threads fetches each file from a URL at publish time.
Frequently asked questions
Do I have to use MCP with LangChain?
No. You can wrap POST /v1/posts in a plain LangChain tool, or use the TypeScript SDK. MCP saves you writing tool schemas.
Should a LangChain agent auto-publish to Threads?
Only once it has earned it. Start the agent draft-only for Threads and promote it on the trust ladder after a run of clean approvals; a guardrail failure demotes it immediately.
What happens if a Threads publish fails?
The post is marked failed with the error, a post.failed webhook fires if you registered one, and you can fix and retry from the inbox.