Concurrent Process Algebra for AI Agents
/install cpa-agents
CPA Agents for OpenClaw
Version: 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.
Install
1) Install library dependency
npm install cpa-agents
2) Create skill entrypoint
import { createOpenClawSkill } from "cpa-agents/adapters/openclaw";
export default createOpenClawSkill();
3) Runtime prerequisites
- OpenClaw Gateway is running and reachable.
- Skill host supports async command handlers.
- Session context provides
appendEventfor trace streaming.
Advanced operators
Use these when you need stronger control over failures, rollback, and data lineage.
Undo / rollback (invertible + saga)
invertible(forward, undo)defines a step plus compensating action.saga([...steps])executes steps in order; on failure, runs undo in reverse order.- Best for workflows with side effects (branch creation, file writes, merges, etc.).
Pattern:
import { invertible, saga } from "cpa-agents";
const workflow = saga([
invertible(createBranch, deleteBranch),
invertible(writeCode, revertCode),
invertible(runValidation, cleanupValidation),
]);
Provenance (converse)
converse(R, inverseFn)is relational provenance, not operational undo.- Use it to answer: "which input(s) could have produced this output?"
- Keep this separate from rollback logic (
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", "")]);
Guarded flow (guard, guardValue, ifThenElse)
- Use
guard(...)to block unsafe execution. - Use
guardValue(...)when a required value must exist. - Combine with
ifThenElse(...)for conditional routing.
Reliability (retryWithBackoff, timeout, or)
retryWithBackofffor transient failures.timeout(ms, process)to bound execution.or(primary, fallback)for fallback routing when primary fails.
Practical guidance: undo vs converse
- Use undo (
invertible+saga) when you must reverse side effects. - Use converse for provenance/audit and lineage queries.
- Typical production setup uses both:
sagaduring executionconversefor post-run explainability
Commands
parallel
Run independent tasks concurrently.
{
"tasks": [
"analyze failing tests",
"draft fix proposal",
"write migration notes"
],
"timeout": 300000
}
branch-fix
Run one task, and if errors are returned, branch into fix flow and continue.
{
"task": "implement auth middleware and resolve lint issues",
"timeout": 300000
}
fan-out
Run the same task across multiple models and merge outputs.
{
"task": "propose API surface for agent orchestration",
"models": ["model-a", "model-b"],
"timeout": 300000
}
status
Return the current CPA process tree/status for the session.
{}
Recommended prompts
- "Run parallel: audit security risks, propose patch plan, generate tests"
- "Branch-fix this refactor until no type errors remain"
- "Fan-out this architecture question across two models and compare"
- "Show cpa status"
- "Execute as saga: create branch, patch files, validate, rollback on failure"
- "Show provenance: what input likely produced this output?"
Troubleshooting
- Gateway not connected:
- Start OpenClaw Gateway and retry.
- Unknown command:
- Use one of:
parallel,branch-fix,fan-out,status.
- Use one of:
- Timeout:
- Increase
timeoutin command args.
- Increase
- Missing session events:
- Ensure session context is present and
appendEventis enabled.
- Ensure session context is present and
- Rollback did not occur:
- Verify steps are wrapped with
invertible(...)and executed withsaga(...).
- Verify steps are wrapped with
- Provenance unclear:
- Provide an explicit
inverseFnwhen definingconverse(...).
- Provide an explicit
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install cpa-agents - 安装完成后,直接呼叫该 Skill 的名称或使用
/cpa-agents触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Concurrent Process Algebra for AI Agents 是什么?
Manage AI agent workflows using concurrent process algebra patterns like parallel tasks, branch-fix loops, fan-out comparisons, and session status tracking. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 91 次。
如何安装 Concurrent Process Algebra for AI Agents?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install cpa-agents」即可一键安装,无需额外配置。
Concurrent Process Algebra for AI Agents 是免费的吗?
是的,Concurrent Process Algebra for AI Agents 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Concurrent Process Algebra for AI Agents 支持哪些平台?
Concurrent Process Algebra for AI Agents 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Concurrent Process Algebra for AI Agents?
由 José I. O.(@jose-compu)开发并维护,当前版本 v2.0.0。