Prompt
Threads agent instructions: write in a casual first-person founder voice, under 450 characters, no hashtags, then call draft_post for threads. Input: we are launching a Chrome extension that summarizes long email threads. 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.
- Connect the MCP server Create an MCPServerStreamableHttp with url https://app.socialhandoff.com/mcp and an Authorization: Bearer header, and open it with async with.
- Attach it to an Agent Pass it in mcp_servers when you build the Agent. Write instructions that name Threads, its length limit, and the draft_post tool.
- Run and trace Call Runner.run, then read the trace to see each tool call. The post id in the output points at a pending draft in the approval inbox.
Example draft
Launching today: a Chrome extension that reads a long email thread and gives you the 3 lines that matter, who is waiting on you, and what was decided. I built it because I kept scrolling through 40-reply threads looking for one date. It is free while we are in early access.
Gotchas
- 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.
- Keep each Threads post within 500 characters, and remember that Threads counts emoji by their UTF-8 bytes, so a few emoji use more of the limit than they appear to. The per-network length guardrail flags longer drafts before they reach the inbox.
- 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.
- Do not design a handoff where one agent approves another's draft. Agent keys cannot call approve_post; that step belongs to a person or an owner key.
- 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
Does this work with non-OpenAI models in the SDK?
The MCP server does not care which model calls it. Any model the Agents SDK can drive can call draft_post.
Should an OpenAI Agents SDK 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.
Can I post videos to Threads?
Yes. Threads takes a single video, or mixes videos and images in a carousel of 2 to 20 items. SocialHandoff serves the file at a signed URL, so the only requirement is that your API is reachable over public HTTPS.