Skip to content

feat: add sdk.tasks module to @webiny/sdk#5106

Merged
adrians5j merged 14 commits intonextfrom
adrian/sdk-bg-tasks-2026-04-16
Apr 19, 2026
Merged

feat: add sdk.tasks module to @webiny/sdk#5106
adrians5j merged 14 commits intonextfrom
adrian/sdk-bg-tasks-2026-04-16

Conversation

@adrians5j
Copy link
Copy Markdown
Member

@adrians5j adrians5j commented Apr 16, 2026

What changed

@webiny/sdk now exposes a tasks sub-SDK (sdk.tasks) for interacting with Webiny's Background Tasks system from external applications. Developers can list registered task definitions, list task runs and their status, fetch execution logs (with optional filtering by task run ID), trigger new task executions, and abort running tasks — all through the same Result-based API used by the rest of the SDK.

The SDK playground (app-sdk-playground) is updated with full ambient TypeScript declarations for the new module, giving in-browser editors full autocomplete and type checking for sdk.tasks.

Why

There was no programmatic way to interact with Background Tasks from external apps using the SDK. The GQL API existed but required developers to write raw queries/mutations and handle the response envelope manually. The new sdk.tasks module wraps those operations behind a consistent, type-safe interface that matches the existing SDK patterns.

How

Added packages/sdk/src/methods/tasks/ containing five method files (listDefinitions, listTasks, listLogs, triggerTask, abortTask) plus a shared taskTypes.ts. A new TasksSdk class (TasksSdk.ts) composes those methods and is wired into the Webiny class as sdk.tasks. All types are re-exported from index.ts.

A notable detail: the triggerTask mutation uses WebinyBackgroundTaskDefinitionEnum! (not String!) for the definition argument — this is enforced at the GraphQL schema level and must match a registered definition ID.

The playground declaration file (declarations/tasks.ts) adds SdkTasks and its supporting interfaces to the Monaco global ambient context.

Changelog

Added Tasks SDK to @webiny/sdk

External applications can now interact with Webiny Background Tasks through the SDK. The new sdk.tasks module lets you list task definitions and runs, retrieve execution logs, trigger new tasks, and abort running tasks — using the same type-safe Result API as the rest of the SDK.

Squash Merge Commit

feat: add sdk.tasks module to @webiny/sdk

@adrians5j adrians5j added this to the 5.3.0 milestone Apr 16, 2026
@adrians5j adrians5j changed the title adrian/sdk-bg-tasks-2026-04-16 feat: add sdk.tasks module to @webiny/sdk Apr 19, 2026
@adrians5j adrians5j merged commit 5408e75 into next Apr 19, 2026
15 checks passed
@adrians5j adrians5j deleted the adrian/sdk-bg-tasks-2026-04-16 branch April 19, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant