Developer docs SDK
Workflow module
Everything the workflow module exposes to your script — tasks, MCP, project status, memories, knowledge, and reactive state. Import from `workflow` (Python) or `@allybuild/sdk` (TypeScript).
Python
The platform materializes two files next to your script: workflow.py — pure bindings built from the SDK — and starter.py, the entry that loads task_script.py and dispatches run / on_change. Import the bindings as plain module-level names:
from workflow import (
params, reporter, client,
create_task, wait_task, feedback, flush_tasks,
list_tasks, get_task, memories, okf,
mcp, project_status, fetch_statuses,
TASK_ID, PROJECT_ID, TASK_JWT,
)| Name | Kind | Purpose |
|---|---|---|
| params | dict | TASK_PARAMS parsed from JSON |
| reporter | Reporter | set_phase / set_progress |
| client | AllyBuildClient | Pre-configured platform client |
| create_task / wait_task | TasksApi | Spawn and await project tasks |
| feedback | callable | Answer a sub-task waiting in pending_approval |
| flush_tasks | callable | Join background on_complete threads before exit |
| list_tasks / get_task | TasksApi | Inspect task instances |
| list_agents / list_workspaces | AgentsApi | Roster and workspace reads |
| memories | MemoriesApi | Task-type and per-run memories |
| list_task_type_memories / get_task_memories | callable | Direct memory reads |
| okf | OkfApi | Knowledge-base search and lint |
| okf_search / okf_lint | callable | Direct knowledge-base calls |
| mcp / mcp_call / async_mcp_call | MCP | Project MCP tools |
| project_status | ProjectStatusProxy | Reactive shared project state |
| fetch_statuses | callable | Fetch every status store in the project |
| project_tokens | dict | ALLYBUILD_PROJECT_TOKENS parsed from JSON |
| defineStore / create_reactive / field / getter / action | reactive | Declare reactive stores and wire the registry |
| TASK_ID / PROJECT_ID / TASK_JWT | str | Injected identifiers |
| ALLYBUILD_API_URL | str | Platform API base URL, including /api |
| BG_SERVICE_ID / SERVICE_WORKSPACE_ID | str | Background-service context (service id / bound workspace) |
TypeScript
The platform copies two files next to your script: workflow.ts — pure bindings built from the SDK — and starter.ts, the entry that loads task_script.ts and dispatches run / on_change. Import the bindings straight from the package root:
import {
params, reporter,
create_task, wait_task, flush_tasks,
mcp, project_status,
TASK_ID, PROJECT_ID, TASK_JWT,
} from '@allybuild/sdk'| Name | Kind | Purpose |
|---|---|---|
| params | object | TASK_PARAMS parsed from JSON |
| reporter | Reporter | set_phase / set_progress |
| create_task / wait_task | TasksApi | Spawn and await project tasks |
| flush_tasks | callable | Join background on_complete callbacks before exit |
| mcp / mcp_call | MCP | Project MCP tools |
| project_status | ProjectStatusProxy | Reactive shared project state |
| project_tokens | object | ALLYBUILD_PROJECT_TOKENS parsed from JSON (read-only secrets) |
| defineStore / createReactive / HttpBackend | reactive | Re-exported from @allybuild/sdk — declare stores and wire the registry |
| TASK_ID / PROJECT_ID / TASK_JWT | string | Injected identifiers |
| ALLYBUILD_API_URL | string | Platform API base URL, including /api |
| BG_SERVICE_ID / SERVICE_WORKSPACE_ID | string | Set when the script runs as a background service |
Calling conventions
- Function-based (recommended) — export
run(params, reporter); the starter entry calls it and prints the returned dict as the result. - Module-level — top-level side effects run at import time; background-service scripts define
on_change(mutation, state)instead.