Last updated: November 12, 2026
Post to X from Claude Managed Agents
Claude Managed Agents runs your agent on Anthropic's infrastructure, and since June 2026 it can run it on a cron. It has no X tool of its own. Add the OpenTweet MCP server to the agent, put your OpenTweet key in a vault, allow mcp.opentweet.io in the environment, and create a scheduled deployment. The agent writes the posts; OpenTweet publishes them to X at the times it picks, with no X developer account.
7-day free trial with a few limits, or pay now for full limits.
The short answer
- Agent:
mcp_servers: [{type: "url", name: "opentweet", url: "https://mcp.opentweet.io/mcp"}]plus anmcp_toolsetset toalways_allow. - Vault: a
static_bearercredential with the same URL inmcp_server_urland yourot_key astoken. - Environment:
allowed_hosts: ["mcp.opentweet.io"]if networking is limited. - Deployment:
POST /v1/deploymentswith a cron, a timezone, the vault ID and the run instructions.
Built from Anthropic's Managed Agents docs (agent setup, MCP connector, vaults, environments, scheduled deployments, permission policies and pricing) and the June 2026 announcement, read November 12, 2026. Managed Agents is in beta (header managed-agents-2026-04-01, which the SDKs set for you), so field names can change.
Step 1: the agent, the vault and the environment
Connect your X account in OpenTweet and create a key on the developer page first. Then run this once. It creates three objects you reuse for every run.
import os
import anthropic
client = anthropic.Anthropic() # reads ANTHROPIC_API_KEY
MCP_URL = "https://mcp.opentweet.io/mcp"
# 1. The agent: OpenTweet as an MCP server, allowed to act without asking
agent = client.beta.agents.create(
name="X poster",
model="claude-sonnet-5-5",
system=open("voice.md").read(), # how the account writes
mcp_servers=[{"type": "url", "name": "opentweet", "url": MCP_URL}],
tools=[
{"type": "agent_toolset_20260401"},
{"type": "mcp_toolset", "mcp_server_name": "opentweet",
"default_config": {"permission_policy": {"type": "always_allow"}}},
],
)
# 2. The key lives in a vault, matched to the server by URL
vault = client.beta.vaults.create(display_name="OpenTweet")
client.beta.vaults.credentials.create(
vault_id=vault.id,
display_name="OpenTweet API key",
auth={"type": "static_bearer", "mcp_server_url": MCP_URL,
"token": os.environ["OPENTWEET_API_KEY"]},
)
# 3. Only the hosts the agent needs
env = client.beta.environments.create(
name="x-poster",
config={"type": "cloud",
"networking": {"type": "limited", "allowed_hosts": ["mcp.opentweet.io"]}},
)
print(agent.id, vault.id, env.id)The mcp_servers entry carries no key on purpose: Anthropic's docs say no tokens go in the agent. At run time, the vault credential whose mcp_server_url matches the server's URL is injected as Authorization: Bearer, which is exactly what OpenTweet's hosted server expects. Running several X accounts? Use one key and have the agent pass x_account_id (it can look the IDs up with opentweet_list_accounts).
Step 2: run it on a schedule
A scheduled deployment starts a new session on each cron tick with the same first message. This one runs at 7:00 New York time on weekdays and schedules three posts for the day.
RUN = """Plan today's posts for the account.
1. Call opentweet_list_tweets for posts scheduled or published in the last 7 days.
Don't repeat a topic or an opening line from that list.
2. Write 3 posts from notes.md, under 280 characters each, no links.
3. Schedule them with opentweet_create_tweet and scheduled_date at
10:00, 13:00 and 17:00 America/New_York today.
4. Reply with the three texts and their times."""
deployment = client.beta.deployments.create(
name="Weekday X posts",
agent=agent.id,
environment_id=env.id,
vault_ids=[vault.id],
initial_events=[{"type": "user.message",
"content": [{"type": "text", "text": RUN}]}],
schedule={"type": "cron", "expression": "0 7 * * 1-5",
"timezone": "America/New_York"},
)
print(deployment.id)Let OpenTweet own the posting time
Anthropic adds jitter to every run: up to 15% of the interval between runs, from 5 seconds to 9 minutes. Run the agent early and have it passscheduled_date to opentweet_create_tweet. OpenTweet publishes at that minute, and the posts show up in your OpenTweet queue, where you can edit or delete them before they go out.Want to review before anything goes out? Leave out scheduled_date and publish_now: opentweet_create_tweet then saves drafts, and you approve them in OpenTweet. Before you turn on the cron, start one session by hand (POST /v1/sessions with the same agent, environment and vault) to check the key and the host.
Three settings that stop unattended posts
Each one works fine when you watch a session in the Console and fails at 7 a.m. when nobody is there.
The run waits forever
MCP toolsets default to always_ask. Nobody is there to approve on a scheduled run, and Anthropic's docs say the session "waits indefinitely". Set permission_policy to always_allow on the OpenTweet toolset. Keep it narrow: allow OpenTweet, not every tool.
The deployment pauses itself
In a limited-network environment no hosts are allowed by default, and session creation returns a 400 if the MCP host isn't allowed. Add mcp.opentweet.io to allowed_hosts (hostname only, no https:// or /mcp) or set allow_mcp_servers to true. A blocked MCP call auto-pauses the deployment.
The call goes out without a key
The vault credential's mcp_server_url must match the agent's url after normalization. https://mcp.opentweet.io/mcp works; https://mcp.opentweet.io or a different path does not, and the connection is tried unauthenticated (OpenTweet answers 401). Credentials are only checked at run time, so test with one manual session first.
What a run costs
Anthropic bills $0.08 per session-hour while a session is running (idle time doesn't count), plus normal token prices. Its own example: a one-hour Opus 5.5 session with 50,000 input and 15,000 output tokens costs $0.58. A posting run that reads your notes and schedules three posts takes minutes, not an hour, so most of the cost is tokens, and a smaller model keeps it low. Web search inside a session adds $10 per 1,000 searches.
On the OpenTweet side there is no per-post or per-call fee. The plan sets how many posts a day and how many carry a link:
| Setup | Limits | Plan |
|---|---|---|
| One account, a few posts a day from one agent | Up to 20 posts a day, 1 link post a day | Pro, $19.99/mo |
| News or alerts with source links, or up to 3 X accounts | Up to 100 posts a day, 10 link posts a day | Advanced, $29/mo |
| An agent running a network of accounts | Up to 300 posts a day, 20 link posts a day, 10 X accounts | Agency, $49/mo |
A post over the day's link allowance fails at publish time, so tell the agent "no links" on Pro or buy link credits. Calling the X API yourself costs per post; see the best API to post to X.
Managed Agents or another Claude option?
- Managed Agents if you want Anthropic to host and schedule the agent, with logs per session and no server of your own. It is an API product, billed to your Claude Platform account.
- Claude Agent SDK if you already run servers or cron and want the same agent loop in your own code.
- Claude Code routines if your voice notes and topics live in a repository and a weekly plan is enough.
- Claude chat or Desktop if you want to ask for posts and approve them yourself, with no code.
All four use the same OpenTweet MCP server and the same key, so you can start in chat and move to a deployment later without changing anything on the OpenTweet side.
Frequently asked questions
Can Claude Managed Agents post to X?
Not on their own: Managed Agents has no built-in X tool. Add an MCP server that can post, such as OpenTweet's hosted server at https://mcp.opentweet.io/mcp, to the agent's mcp_servers, store your OpenTweet key in a vault as a static_bearer credential, and pass the vault ID when you start a session or create a deployment. The agent then has 43 OpenTweet tools, including opentweet_create_tweet, and posts through your connected X account with no X developer account.
How do I pass an API key to an MCP server in Claude Managed Agents?
Through a vault, not the agent. The mcp_servers entry only takes type, name and url. Create a vault, add a credential with auth type "static_bearer", the server's exact URL in mcp_server_url and the key in token, then list the vault in vault_ids on the session or deployment. Anthropic injects the token when the agent connects to a server at that URL. The URL has to match after normalization, so a different path means the call goes out without a token.
How do I run a Claude Managed Agent on a schedule?
Create a scheduled deployment: POST /v1/deployments with the agent ID, environment_id, vault_ids, initial_events (the message each run starts with) and a schedule of {"type": "cron", "expression": "0 9 * * 1-5", "timezone": "America/New_York"}. The cron is a 5-field POSIX expression with minute-level granularity, and the timezone is required. Scheduled deployments and vaults went into public beta on June 9, 2026.
Why does my scheduled Managed Agent never post?
Usually one of three settings. MCP toolsets default to the always_ask permission policy, and an unattended session waits for approval indefinitely, so set the OpenTweet toolset to always_allow. A limited-network environment allows no hosts unless you add mcp.opentweet.io to allowed_hosts or set allow_mcp_servers to true; a blocked MCP host auto-pauses the deployment. And the vault credential's mcp_server_url must match the agent's url exactly.
How much does it cost to post from a Claude Managed Agent?
Anthropic charges $0.08 per session-hour while the session is running, measured to the millisecond, plus normal token prices; web search inside a session is $10 per 1,000 searches. A daily run that reads a few sources and schedules three posts usually takes a few minutes, so the runtime part is well under a cent a day. OpenTweet is a flat $19.99 a month on Pro, with no per-post fee.
Will my post go out at the exact minute of the cron?
Not exactly. Anthropic adds jitter of up to 15% of the interval between runs, between 5 seconds and 9 minutes. If the time of the post matters, run the agent earlier and have it schedule each post with scheduled_date in opentweet_create_tweet. OpenTweet then publishes at that minute, whenever the agent ran.
Keep exploring
Other ways to give Claude a posting tool for X.
Claude Agent SDK
The same MCP server in an agent you host yourself.
Schedule a Claude routine to post
Claude Code routines: a weekly plan of posts from a repository.
Can Claude Duet post to X?
Anthropic's consumer agent and what it can connect to.
OpenTweet MCP server
The hosted endpoint with 43 tools for X, LinkedIn and Bluesky.
Migrate from OpenAI Agent Builder
Agent Builder shuts down November 30, 2026. Where to move a posting agent.
X automation rules
What an automated account has to do to stay within X's rules.
Your agent writes. OpenTweet posts.
Connect X, create a key, and point your Managed Agent at mcp.opentweet.io.
7-day free trial with a few limits, or pay now for full limits.