For AI agents
Your agent's alarm clock.
Agents are great at acting now. anticipated lets them act later. One MCP URL lets a Claude agent schedule its own follow-up, wait days with nothing running, and wake up with the notes it left itself.
Wake-ups count as events. 5,000 free every month.
Mon 10:02 AM
Agent emails the customer, then schedules a follow-up
schedule_event(when: "in 48 hours", key: "ticket-9921-followup")
48 hours
Nothing running. No tokens, no polling, no open process.
Wed 10:02 AM
We wake the agent with its saved notes
Signed POST to your endpoint: the ticket, what it promised, what to check.
Wed 10:03 AM
Agent sees no reply, follows up, closes the loop
Between API calls, your agent doesn't exist.
So "check back Thursday" turns into a cron job, a queue, a state table and glue code. Or you hand it one tool.
Building it yourself
- A scheduler or cron that never misses
- A table of pending wake-ups and their context
- Retry logic when the agent endpoint is down
- Tool wiring for each model provider
- No record of what woke up, when, or why
With anticipated
- One tool call: schedule_event
- Context travels in the notes; we store them
- Signed delivery with retries
- A standard remote MCP server, no SDK to install
- Every delivery attempt logged with status and latency
Recipe · Claude
A support agent that never forgets to follow up.
Your Claude agent answers a ticket and schedules a check-in for 48 hours later, keyed to the ticket. It needs no tool code: Claude calls anticipated directly through the MCP connector. When the check-in fires, your endpoint verifies the signature and starts a new run with the notes. If the customer replies first, your backend cancels it by key.
schedule_event( when: "in 48 hours", url: WAKE_URL, key: "ticket-9921-followup", notes: { ticket: 9921, promised: "fix for CSV import" }) # customer replied first: cancel_event(key: "ticket-9921-followup")
Three files, Node 22+ and @anthropic-ai/sdk. Run schedule.ts once to start the agent and keep wake.ts listening at your WAKE_URL.
import Anthropic from '@anthropic-ai/sdk'
/**
* One Claude turn with anticipated.io connected as a remote MCP server. Claude can call
* schedule_event, get_event and cancel_event on its own; no tool code runs on your side.
*/
const client = new Anthropic() // ANTHROPIC_API_KEY
export const MCP_URL = process.env.ANTICIPATED_MCP_URL ?? 'https://v2-api.anticipated.io/mcp'
export const WAKE_URL = process.env.WAKE_URL! // where anticipated POSTs when a follow-up fires
const SYSTEM = `You are a support agent. You can't wait, so when something needs checking later, schedule it
with the anticipated schedule_event tool: url ${WAKE_URL}, a key naming the ticket (like "ticket-9921-followup"),
and notes holding everything your future self will need. When you are woken, the notes are the first message.`
export async function runAgent(prompt: string): Promise<string> {
const response = await client.beta.messages.create({
model: 'claude-opus-5-5',
max_tokens: 16000,
betas: ['mcp-client-2025-11-20', 'server-side-fallback-2026-07-01'],
fallbacks: 'default',
system: SYSTEM,
mcp_servers: [{ type: 'url', name: 'anticipated', url: MCP_URL, authorization_token: process.env.ANTICIPATED_API_KEY }],
tools: [{ type: 'mcp_toolset', mcp_server_name: 'anticipated' }],
messages: [{ role: 'user', content: prompt }]
})
if (response.stop_reason === 'refusal') return `Declined: ${response.stop_details?.explanation ?? 'no reason given'}`
for (const block of response.content) {
if (block.type === 'mcp_tool_use') console.log(`→ ${block.name}`, JSON.stringify(block.input))
}
return response.content.flatMap((b) => (b.type === 'text' ? [b.text] : [])).join('\n')
}
/**
* Step 2: the endpoint anticipated calls when the follow-up fires. It checks the signature, answers
* 200 right away (deliveries time out after 10 s and are retried), then starts a new agent run with
* the notes the agent left itself.
* ANTHROPIC_API_KEY=... ANTICIPATED_API_KEY=ak_... ANTICIPATED_SIGNING_SECRET=whsec_... pnpm wake
*/
import { createServer } from 'node:http'
import { runAgent } from './agent.js'
import { verifySignature } from './verify.js'
const SECRET = process.env.ANTICIPATED_SIGNING_SECRET!
const handled = new Set<string>() // use your database in production: a retry can arrive after a timeout
createServer(async (req, res) => {
if (req.method !== 'POST' || req.url !== '/wake') return void res.writeHead(404).end()
let body = ''
for await (const chunk of req) body += chunk
if (!verifySignature(SECRET, body, req.headers['x-anticipated-signature'] as string | undefined)) return void res.writeHead(401).end()
const { id, when, document: notes } = JSON.parse(body) as { id: string; when: string; document: unknown }
res.writeHead(200).end()
if (handled.has(id)) return
handled.add(id)
const reply = await runAgent(`You scheduled this follow-up for ${when}. Your notes:\n${JSON.stringify(notes, null, 2)}\nDo what they say.`)
console.log(`woke ${id}:`, reply)
}).listen(Number(process.env.PORT ?? 8787))
import { createHmac, timingSafeEqual } from 'node:crypto'
/**
* Check an anticipated.io webhook signature.
* Header: x-anticipated-signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, "<t>.<raw body>")>
* During a secret rotation there is one v1 per secret; any match is accepted.
*/
export function verifySignature(secret: string, rawBody: string, header: string | undefined, toleranceS = 300): boolean {
const parts = (header ?? '').split(',').map((kv): [string, string] => [kv.slice(0, kv.indexOf('=')), kv.slice(kv.indexOf('=') + 1)])
const t = Number(parts.find(([k]) => k === 't')?.[1])
if (!Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > toleranceS) return false
const expected = createHmac('sha256', secret).update(`${t}.${rawBody}`).digest()
return parts.some(([k, v]) => {
if (k !== 'v1') return false
const given = Buffer.from(v, 'hex')
return given.length === expected.length && timingSafeEqual(given, expected)
})
}
How a wake-up works
Agent schedules
It calls schedule_event with a time, a key, and notes for its future self.
We hold it
Minutes or months. Your backend can check or cancel it by key at any point.
We call you back
A signed POST to your endpoint with the saved notes, retried if you're down.
The agent picks up
Your code starts a new run with those notes as the first message.
Coming soon: hosted wake-ups
Skip step 4. We call the model for you with the saved prompt and tools, and send you the result.
What agents use it for
Support follow-ups
"If they haven't replied in 48 hours, check in." Cancelled the moment they do.
Sales sequences
Day 2 and day 7 touches, each written fresh from what happened since.
Coding agents
Check the deploy in 20 minutes. Retry the flaky job Friday. Roll back if it failed.
Approval timeouts
No sign-off by end of day? Escalate to the next approver.
The chat apps already schedule. Why this?
Scheduled tasks in chat apps are built for one person in a chat. anticipated is built for the agent inside your product.
| Capability | Chat-app tasks | anticipated |
|---|---|---|
| Where it runs | In the chat app | In your product |
| Who can cancel it | The user, by hand | Your backend, by key |
| Where the result goes | A notification to the user | Your webhook, queue or agent |
| Audit trail | Task history | Every delivery attempt, with status and latency |
Written for agents to read, too.
Each tool carries a plain-language description, so a model knows when to reach for it without a prompt from you.
MCP URL: https://v2-api.anticipated.io/mcp
Auth: your API key as Authorization: Bearer. Streamable HTTP, stateless.
Teach your agent to come back later.
Wake-ups are events on the same plans. 5,000 free a month.