Agents SDK adds MCP Elicitation, HTTP streaming, task queues, and email integration
The Cloudflare Agents SDK now supports MCP elicitation for interactive user input during tool execution, HTTP streamable transport for improved MCP performance and reliability, lightweight task queues for background work, email integration for automated email responses, and automatic context wrapping for custom methods.
The latest releases of @cloudflare/agents ↗ brings major improvements to MCP transport protocols support and agents connectivity. Key updates include:
MCP elicitation support
MCP servers can now request user input during tool execution, enabling interactive workflows like confirmations, forms, and multi-step processes. This feature uses durable storage to preserve elicitation state even during agent hibernation, ensuring seamless user interactions across agent lifecycle events.
// Request user confirmation via elicitation
const confirmation = await this.elicitInput({
message: `Are you sure you want to increment the counter by ${amount}?`,
requestedSchema: {
type: "object",
properties: {
confirmed: {
type: "boolean",
title: "Confirm increment",
description: "Check to confirm the increment",
},
},
required: ["confirmed"],
},
});
Check out our demo ↗ to see elicitation in action.
HTTP streamable transport for MCP
MCP now supports HTTP streamable transport which is recommended over SSE. This transport type offers:
- Better performance: More efficient data streaming and reduced overhead
- Improved reliability: Enhanced connection stability and error recover- Automatic fallback: If streamable transport is not available, it gracefully falls back to SSE
export default MyMCP.serve("/mcp", {
binding: "MyMCP",
});
The SDK automatically selects the best available transport method, gracefully falling back from streamable-http to SSE when needed.
Enhanced MCP connectivity
Significant improvements to MCP server connections and transport reliability:
- Auto transport selection: Automatically determines the best transport method, falling back from streamable-http to SSE as needed
- Improved error handling: Better connection state management and error reporting for MCP servers
- Reliable prop updates: Centralized agent property updates ensure consistency across different contexts
Lightweight .queue for fast task deferral
You can use .queue() to enqueue background work — ideal for tasks like processing user messages, sending notifications etc.
class MyAgent extends Agent {
doSomethingExpensive(payload) {
// a long running process that you want to run in the background
}
queueSomething() {
await this.queue("doSomethingExpensive", somePayload); // this will NOT block further execution, and runs in the background
await this.queue("doSomethingExpensive", someOtherPayload); // the callback will NOT run until the previous callback is complete
// ... call as many times as you want
}
}
Want to try it yourself? Just define a method like processMessage in your agent, and you’re ready to scale.
New email adapter
Want to build an AI agent that can receive and respond to emails automatically? With the new email adapter and onEmail lifecycle method, now you can.
export class EmailAgent extends Agent {
async onEmail(email: AgentEmail) {
const raw = await email.getRaw();
const parsed = await PostalMime.parse(raw);
// create a response based on the email contents
// and then send a reply
await this.replyToEmail(email, {
fromName: "Email Agent",
body: `Thanks for your email! You've sent us "${parsed.subject}". We'll process it shortly.`,
});
}
}
You route incoming mail like this:
export default {
async email(email, env) {
await routeAgentEmail(email, env, {
resolver: createAddressBasedEmailResolver("EmailAgent"),
});
},
};
You can find a full example here ↗.
Automatic context wrapping for custom methods
Custom methods are now automatically wrapped with the agent's context, so calling getCurrentAgent() should work regardless of where in an agent's lifecycle it's called. Previously this would not work on RPC calls, but now just works out of the box.
export class MyAgent extends Agent {
async suggestReply(message) {
// getCurrentAgent() now correctly works, even when called inside an RPC method
const { agent } = getCurrentAgent()!;
return generateText({
prompt: `Suggest a reply to: "${message}" from "${agent.name}"`,
tools: [replyWithEmoji],
});
}
}
Try it out and tell us what you build!
Source: original entry ↗
More from Cloudflare
Follow Cloudflare to get its new changes in your feed and email digest.
Cloudflare One Client for macOS 2026.8.2100.0
GA release for macOS Cloudflare One Client with improved split tunnel handling that no longer briefly blocks traffic during reconnects, support for non-RFC 1918 local IPv4 networks, faster connects with lower memory use, and numerous reliability fixes across DNS, reauthentication, and client stability.
Cloudflare One Client for Windows 2026.8.2100.0
This GA release improves split tunnel reliability, adds support for non-RFC 1918 local networks, optimizes connection performance with faster reconnections and lower memory usage, and includes numerous bug fixes for DNS, registration, and network handling. The client now features a service recovery mechanism that automatically restarts on system unlock and better handles large hosts files without blocking traffic.
Cloudflare One Client for Linux 2026.8.2100.0
New GA release for Linux with improved split tunnel handling that no longer briefly blocks traffic during reconnects, support for non-RFC 1918 local IPv4 networks, faster tunnel reconnections, and lower memory usage. Includes numerous stability and reliability fixes for DNS, reconnection behavior, and crash issues.