Workflows createBatch() now supports count or instances options
The createBatch() method now accepts an options object to create up to 100 Workflow instances in a single call, with support for creating instances by count with shared options or by providing individual instance configurations with unique IDs. The result provides details on created instances and errors, with improved error reporting for duplicate or existing IDs.
createBatch() now accepts an options object that creates up to 100 Workflow instances in one call. The result lists the created instances and explains why any others were not created. To use this form in local development and get its types from wrangler types, use Wrangler 4.148.0 or later.
To create instances that share the same options, pass count. Each instance receives a generated ID:
const result = await env.MY_WORKFLOW.createBatch({
count: 10,
params: { report: "daily" },
});const result = await env.MY_WORKFLOW.createBatch({
count: 10,
params: { report: "daily" },
});
To give each instance its own ID or options, pass instances:
const { created, errors } = await env.MY_WORKFLOW.createBatch({
instances: [
{ id: "order-1", params: { orderId: 1 } },
{ id: "order-2", params: { orderId: 2 } },
],
});
for (const error of errors) {
console.log(error.index, error.id, error.code, error.message);
}const { created, errors } = await env.MY_WORKFLOW.createBatch({
instances: [
{ id: "order-1", params: { orderId: 1 } },
{ id: "order-2", params: { orderId: 2 } },
],
});
for (const error of errors) {
console.log(error.index, error.id, error.code, error.message);
}
created contains the created instances. errors contains each entry that was not created, identified by its position in the input. IDs that already exist and IDs repeated within the batch are reported as errors instead of being skipped silently.
Passing an array to createBatch() is deprecated. Existing code that uses the array form continues to work.
For more information, refer to createBatch.
Source: original entry ↗
More from Cloudflare
Follow Cloudflare to get its new changes in your feed and email digest.
Persistent browser tool in Agents SDK with tabs and logins
The Cloudflare Agents SDK now includes a browserTool that allows agents to maintain a persistent browser session across multiple turns, preserving tabs, cookies, and login sessions. The browser remains alive even when the Durable Object hibernates, with a 10-minute idle timeout before creating a fresh session.
Cloudflare API MCP server sends Workers Issues as MCP Events
The Cloudflare API MCP server now exposes Workers Issues as MCP Events through webhook subscriptions, allowing agents to receive real-time notifications when production failures are detected without polling. Clients can subscribe to cloudflare.alert.workers_observability_real_time_issue scoped to an account or individual Worker.
Web Analytics: Deeper Core Web Vitals Diagnostics with LCP & INP Sub-Part Metrics
Real User Monitoring in Web Analytics now breaks down Largest Contentful Paint (LCP) and Interaction to Next Paint (INP) into their constituent phases, plus splits connection time into TCP and TLS components. These sub-part metrics are available in the dashboard and queryable through the GraphQL Analytics API to help identify which specific area is impacting page performance.