Skip to content

Workflow Script Overview

A Workflow script is the core of TaskFlow task execution. Each task runs inside a Docker container that loads workflow.py on startup, then executes your task_script.py.

Two calling conventions

python
# Synchronous
def run(params: dict, reporter) -> None:
    reporter.set_phase("Processing")
    reporter.set_progress(50)

# Async (enables concurrent MCP calls)
async def run(params: dict, reporter) -> None:
    import asyncio
    r1, r2 = await asyncio.gather(
        async_mcp_call("exa", "search", {"query": "..."}),
        async_mcp_call("context7", "resolve", {"query": "..."}),
    )

Import-based (Agent / Hermes tasks)

python
from workflow import params, reporter, TASK_ID, project_status
# Script runs at module level — no run() function needed

Available symbols

SymbolDescription
paramsTask parameter dict
reporterProgress reporting
project_statusReactive project-status proxy
project_tokensRead-only project token dict
create_taskSpawn a sub-task
wait_taskBlock until a task finishes
feedbackSend feedback to a pending-approval task
flush_tasksWait for background callbacks
mcpGet an MCP client
mcp_callOne-liner sync MCP call
async_mcp_callAsync MCP call
list_tasksQuery task list
get_taskQuery a single task
list_agentsQuery agent list
list_workspacesQuery workspace list
list_task_type_memoriesQuery task-type memories
get_task_memoriesQuery memories for one task run
okf_searchKnowledge-base search
okf_lintKnowledge-base health check
defineStoreCreate a reactive state store

Built with VitePress