惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Security Blog
Microsoft Security Blog
Jina AI
Jina AI
量子位
博客园 - 叶小钗
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
IT之家
IT之家
S
SegmentFault 最新的问题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
雷峰网
雷峰网
博客园 - 聂微东
美团技术团队
Last Week in AI
Last Week in AI
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园_首页
V
Visual Studio Blog
大猫的无限游戏
大猫的无限游戏
The Cloudflare Blog

Workflow SDK Documentation

Patterns for Defining Tools Human-in-the-Loop Building Durable AI Agents Queueing User Messages Resumable Streams Sleep, Suspense, and Scheduling Streaming Updates from Tools API Reference Workflow Globals Changelog Resilient run start Cookbook Building a World Deploying Astro Express Fastify Hono Getting Started NestJS Next.js Nitro Nuxt Python SvelteKit Vite corrupted-event-log fetch-in-workflow hook-conflict Errors
createWorld
2026-06-12 · via Workflow SDK Documentation

Create a new World instance from environment configuration.

Creates a new World instance based on environment configuration. The WORKFLOW_TARGET_WORLD environment variable determines which World implementation is instantiated (for example the local development World or the Vercel production World).

Unlike getWorld(), which caches a singleton instance, createWorld() constructs a fresh instance on every call. Application code should almost always use getWorld()createWorld() is for infrastructure code that manages World lifecycles itself.

import { createWorld } from "workflow/runtime";

const world = await createWorld(); 

Parameters

This function does not accept any parameters. Configuration is read from environment variables.

Returns

Returns a newly constructed World instance.

In workflow 4.x, createWorld() is synchronous and returns World directly. It becomes async in 5.x, so writing await createWorld() works on both versions.

Tooling that needs to construct a World with explicit (non-environment) configuration should instantiate the specific World implementation directly and register it with setWorld().

  • getWorld() - Resolve the cached World instance (preferred in application code).
  • setWorld() - Override the cached World instance.