UNPKG

workflow

Version:

Workflow SDK - Build durable, resilient, and observable workflows

61 lines (48 loc) • 3.12 kB
--- title: World SDK description: Low-level API for inspecting and managing workflow runs, steps, events, hooks, streams, and queues, with an analytics namespace for metadata listings and attribute search. type: overview summary: Access workflow infrastructure via await getWorld() for building observability dashboards, admin tools, and custom integrations. prerequisites: - /docs/api-reference/workflow-runtime/get-world keywords: - getWorld - World SDK - workflow runtime - observability dashboard - admin panel - workflow management --- The World SDK provides direct access to workflow infrastructure, including runs, steps, events, hooks, streams, and queues. It also provides a metadata-only [Analytics](/docs/api-reference/workflow-runtime/world/analytics) namespace with attribute discovery and filtering. Use it to build observability dashboards, admin panels, debugging tools, and custom workflow management logic. ```typescript lineNumbers import { getWorld } from "workflow/runtime"; const world = await getWorld(); // [!code highlight] ``` ## Interfaces <Cards> <Card href="/docs/api-reference/workflow-runtime/world/storage" title="Storage"> Query runs, steps, hooks, and the underlying event log. </Card> <Card href="/docs/api-reference/workflow-runtime/world/analytics" title="Analytics"> Metadata-only listings with attribute discovery and filtering, built for observability dashboards. </Card> <Card href="/docs/api-reference/workflow-runtime/world/streams" title="Streams"> Read, write, and manage real-time data streams for workflow runs. </Card> <Card href="/docs/api-reference/workflow-runtime/world/queue" title="Queue"> Low-level queue dispatch (internal SDK infrastructure). </Card> </Cards> <Callout type="info"> The World SDK is the low-level foundation that higher-level functions like [`getRun()`](/docs/api-reference/workflow-api/get-run) and [`start()`](/docs/api-reference/workflow-api/start) are built on. Use it when you need capabilities beyond what those functions provide. </Callout> Beyond these namespaces, the `World` interface carries several top-level members for World authors: `specVersion`, `capabilities`, lifecycle hooks (`start()`/`close()`), `getEncryptionKeyForRun()`, and the optional `createRunId()` / `describeRun()` hooks behind regional run placement and World-specific `inspect` output. [Building a World](/worlds/building-a-world) documents these members. ## Data hydration The [devalue](https://github.com/Rich-Harris/devalue) format serializes step input/output data. To display this data in your UI, use the hydration utilities from `workflow/observability`: ```typescript lineNumbers import { hydrateResourceIO, observabilityRevivers } from "workflow/observability"; // [!code highlight] const step = await world.steps.get(runId, stepId); const hydrated = hydrateResourceIO(step, observabilityRevivers); // [!code highlight] console.log(hydrated.input, hydrated.output); ``` See [`workflow/observability`](/docs/api-reference/workflow-observability) for the full API.