Install
openclaw skills install cpa-agentsManage AI agent workflows using concurrent process algebra patterns like parallel tasks, branch-fix loops, fan-out comparisons, and session status tracking.
openclaw skills install cpa-agentsVersion: 2.0.0
Use concurrent process algebra for practical multi-agent orchestration in OpenClaw. This skill is focused on production workflows: parallel execution, branch-fix loops, model fan-out, and session status introspection.
npm install cpa-agents
import { createOpenClawSkill } from "cpa-agents/adapters/openclaw";
export default createOpenClawSkill();
appendEvent for trace streaming.Use these when you need stronger control over failures, rollback, and data lineage.
invertible + saga)invertible(forward, undo) defines a step plus compensating action.saga([...steps]) executes steps in order; on failure, runs undo in reverse order.Pattern:
import { invertible, saga } from "cpa-agents";
const workflow = saga([
invertible(createBranch, deleteBranch),
invertible(writeCode, revertCode),
invertible(runValidation, cleanupValidation),
]);
converse)converse(R, inverseFn) is relational provenance, not operational undo.invertible/saga).Pattern:
import { rel, converse } from "cpa-agents";
const generate = rel("generate", async (prompt: string) => [prompt + "-out"]);
const provenance = converse(generate, async (output: string) => [output.replace("-out", "")]);
guard, guardValue, ifThenElse)guard(...) to block unsafe execution.guardValue(...) when a required value must exist.ifThenElse(...) for conditional routing.retryWithBackoff, timeout, or)retryWithBackoff for transient failures.timeout(ms, process) to bound execution.or(primary, fallback) for fallback routing when primary fails.invertible + saga) when you must reverse side effects.saga during executionconverse for post-run explainabilityparallelRun independent tasks concurrently.
{
"tasks": [
"analyze failing tests",
"draft fix proposal",
"write migration notes"
],
"timeout": 300000
}
branch-fixRun one task, and if errors are returned, branch into fix flow and continue.
{
"task": "implement auth middleware and resolve lint issues",
"timeout": 300000
}
fan-outRun the same task across multiple models and merge outputs.
{
"task": "propose API surface for agent orchestration",
"models": ["model-a", "model-b"],
"timeout": 300000
}
statusReturn the current CPA process tree/status for the session.
{}
parallel, branch-fix, fan-out, status.timeout in command args.appendEvent is enabled.invertible(...) and executed with saga(...).inverseFn when defining converse(...).