Cloudflare Agents SDK with Pi: connect Sume's MCP tools

Cloudflare's Agents SDK now supports the Pi harness. Point the agent at https://mcp.sume.com/mcp and send an idempotency_key on every paid tool call.

4 min readSume
All posts

To use Sume from a Cloudflare agent, give the agent the hosted MCP endpoint https://mcp.sume.com/mcp and authenticate with either an OAuth token or a Sume API key. Every paid or write tool then needs an idempotency_key.

What Cloudflare announced

The Cloudflare changelog entry dated October 2, 2026 says the Agents SDK now provides first-class support for building agents using the Pi harness, with the agent's work durably persisted even if interrupted mid-turn. Persistence matters for media work, because a generation job outlives a single model turn.

Connect to Sume

Sume's hosted MCP server lives at one URL. The client either follows MCP OAuth discovery or sends Authorization: Bearer <SUME_API_KEY> (or x-api-key).

Sume MCP authentication (read 2026-10-03)
ModeHow it connectsWhat the agent sees
OAuthClient follows MCP discovery and consentmcp:read is read-only; mcp:write adds mutating and paid tools
API keyBearer or x-api-key headerFull hosted tool set

Gates the agent must respect

Paid and write tools are hidden until the session has mcp:write or an API key. There is no mcp:paid scope; spend is governed by the wallet and admission checks.

  • idempotency_key is required on every write and paid tool. Store it with the agent's persisted state so a resumed turn reuses the same key.
  • dry_run=true previews admission and cost without submitting.
  • max_spend_usd is enforced only when you pass it.
  • Call tools_list and tools_schema to read the live contract instead of assuming HTTP parity.

A sensible first run

Have the agent call tools_list, then tools_schema for generate_video, then a dry_run before any real submit. Follow a submit with jobs_wait and jobs_result. Because the Pi harness persists agent state, record the job id and the idempotency key together; on resume, poll the job rather than submitting again.

Sources

Related posts

More in Integrations

All Integrations posts

Written by Sume