Task API#

这些 API 是 Getting Started 中任务声明、workspace guardrail 和 Conductor TaskDef 生成会用到的入口。

task(*, name, owner_email[, description, ...])

Declare the single Perago task exported by a Python module.

TaskDefinition(name, owner_email, fn, ...[, ...])

Validated contract extracted from a single Perago task module.

load_module_task(module_target)

Import a module target and return its single Perago task definition.

WorkspaceSpec(*[, prefix, pre, post, read_only])

Workspace declaration for a workspace task.

require_file(path)

Require one workspace-relative file to exist.

require_dir(path)

Require one workspace-relative directory to exist.

require_glob(pattern, *[, min_count, max_count])

Require a bounded number of workspace files matching a glob pattern.

forbid_glob(pattern)

Reject workspace files matching a glob pattern.

check_guardrails(root, guardrails, phase)

Evaluate workspace guardrails against a local attempt workspace.

build_taskdef(task)

Build the Conductor TaskDef dictionary for one Perago task.

write_taskdef(task, output)

Write a generated Conductor TaskDef to a JSON file.