Communitygithub.com

Agha Actor 模型:并发智能体系统设计

一种基础的并发计算模型,其中参与者通过异步消息传递进行独家通信。

Agha Actor 模型:并发智能体系统设计 是什么?

此技能围绕 Agha Actor 模型,为开发者提供设计并发智能体系统的全面指南。它强调将系统分解为可独立通信的“参与者”(actors),每个参与者拥有自己的状态和行为,并通过异步消息传递进行交互。该技能的核心价值在于避免了传统并发编程中常见的共享状态、同步阻塞和中央协调器反模式,从而提升系统的健壮性、可扩展性和容错性。它支持包括 Claude Code、Cursor、Codex 在内的主流 AI 编码平台。技能文档通过决策树、故障模式分析和实战示例,详细阐述了如何根据任务类型选择合适的参与者创建策略,如何正确使用消息发送与状态替换,以及如何实现失败隔离和动态拓扑重配。最终目的是帮助开发者构建一个actor之间无共享状态、消息传递有序(但不保证顺序)、拓扑可动态变化的正确且可组合的并发系统。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/curiositech/windags-skills/tree/HEAD/skills/agha-actor-model

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

SKILL.md — Agha Actor 模型:并发智能体系统设计

决策点

根据任务类型选择参与者创建策略

IF 任务具有顺序依赖关系:
├─ 使用客户模式: 创建带有回复地址的子actor
├─ 将客户地址作为参数传递给子actor
└─ 子actor将结果直接发送给客户(而不是父actor)

IF 任务需要长时间计算:
├─ 为计算创建不敏感actor
├─ 将入站消息转发到缓冲区actor
└─ 计算完成后从缓冲区恢复处理

IF 任务需要动态资源分配:
├─ 按需创建资源管理器actor
├─ 将能力(地址)作为消息数据传递
└─ 无中央注册表——地址通过系统流动

IF 任务需要故障隔离:
├─ 为高风险操作生成受监督的子actor
├─ 监督者通过缺失的回复检测故障
└─ 替换失败的actor,而不影响其他

IF 需要组合现有智能体系统:
├─ 验证接口是否保留因果结构
├─ 测试组合下的行为(而不仅仅是隔离)
└─ 使用消息协议作为边界(而非共享状态)

消息发送 vs 状态替换决策树

IF 需要与其他智能体协调:
├─ 发送消息(不要先修改本地状态)
├─ 如果预期有响应,则包含回复地址
└─ 永远不要假设消息顺序

IF 需要本地计算:
├─ 指定替换行为
├─ 封装新状态(不暴露内部细节)
└─ 确保一次只处理一条消息

IF 需要动态扩展:
├─ 创建具有特定行为的新actor
├─ 将必要地址传递给新actor
└─ 无共享初始化状态

故障模式

1. 中央编排器反模式

检测: 如果看到一个actor路由所有消息或持有所有系统状态 症状: 单点故障、负载下成为瓶颈、无限递归问题 修复: 分解为actor社区,每个只了解本地上下文,使用能力路由

2. 同步阻塞谬误

检测: 如果actor等待/阻塞响应,而不是指定替换行为 症状: 负载下死锁、隐藏的时间假设、并发性降低 修复: 建模为请求-回复消息对,使用客户模式处理依赖关系,应用不敏感actor模式

3. 共享状态污染

检测: 如果多个actor读/写相同的数据结构(即使有锁) 症状: 竞态条件、顺序瓶颈、隐藏的全局状态 修复: 将状态封装在单个actor中,使用消息传递进行协调,互斥是免费的

4. 仅输出验证

检测: 如果测试只比较最终输出,而不检查交互模式 症状: Brock-Ackerman 异常——相同的输出但不同的组合行为 修复: 验证因果结构保留、测试组合下的行为、使用观察等价性

5. 静态拓扑假设

检测: 如果通信图在启动时固定,无法在运行时重新配置 症状: 无法处理开放系统、无动态资源管理、面对变化时脆弱 修复: 将地址视为一等数据、实现能力路由、支持运行时拓扑变更

实战示例

示例 1:使用客户模式的任务分解

场景: 智能体需要处理一个复杂的请求,该请求需要顺序子任务 A → B → C,但必须保持对其他消息的响应能力。

新手方法:

receive request →
  block while calling subtask A
  block while calling subtask B
  block while calling subtask C
  send final result

Actor 模型的专家应用:

receive request →
  create customer_BC actor with addresses for B, C, final recipient
  send subtask A request to A_processor with customer_BC as reply address
  specify replacement behavior: ready for next request

customer_BC receives A result →
  send result to B_processor with customer_C as reply address

customer_C receives B result →
  send result to C_processor with final_recipient as reply address

所作出的关键决策:

  • 使用客户模式避免阻塞
  • 每一步在链中创建下一个客户
  • 原始智能体在整个过程中保持响应
  • 任何子任务失败仅会影响该链

示例 2:使用监督模式的故障恢复

场景: 系统需要处理智能体故障,而不会级联影响到整个系统。

新手方法: 对智能体调用使用 try-catch,故障时重启所有内容。

专家应用:

supervisor creates worker_actor →
  sends task to worker with reply timeout
  specifies replacement: "waiting_for_reply"

IF reply received within timeout →
  forward result to client
  specify replacement: "ready"

IF timeout expires →
  create new worker_actor (old one failed)
  resend task to new worker
  specify replacement: "waiting_for_reply"

权衡取舍:

  • 监督是与业务逻辑分离的关注点
  • 失败的actor被隔离和替换,而非修复
  • 超时检测与保证传递之间的平衡
  • 监督者和工作者之间无共享状态

质量门禁

  • 没有actor阻塞其消息处理循环(在需要的地方应用了不敏感actor模式)
  • 所有协调都使用消息传递(参与者之间无共享可变状态)
  • 保证消息传递,但不假设顺序
  • 地址被视为能力路由的一等数据
  • 每个actor为每种消息类型指定替换行为
  • actor的创建根据计算需求动态发生
  • 故障隔离防止跨actor边界的级联故障
  • 系统拓扑可以在没有中央注册表的情况下在运行时重新配置
  • 组合行为得到验证,而不仅仅是隔离的组件行为
  • 同步操作建模为请求-回复消息对

非适用边界

此技能不应被用于:

  • 简单的顺序计算 → 改用函数式编程
  • 物理上需要共享内存的系统 → 改用基于锁的并发模式
  • 具有严格时序约束的实时系统 → 使用具有正式时序分析的同步消息传递
  • 无需协调的数学计算 → 改用纯函数式方法

在以下情况委派给其他技能:

  • 实现特定的actor框架 → 使用平台特定的实现指南
  • 对actor系统进行性能调优 → 使用 [performance-optimization] 技能
  • 对actor属性进行形式化验证 → 使用 [formal-methods] 技能
  • 为actor持久性设计数据库 → 使用 [data-architecture] 技能

关于范围常见的误解:

  • Actor不仅仅是“具有异步方法的对象”——它们需要完整的 3 元组响应
  • Actor模型不仅仅适用于分布式系统——适用于任何并发计算
  • 主要不是性能优化——它是一个正确性和可组合性框架

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

curiositech/windags-skills

Expert in 2000s-era music visualization (Milkdrop, AVS, Geiss) and modern WebGL implementations. Specializes in Butterchurn integration, Web Audio API AnalyserNode FFT data, GLSL shaders for audio-reactive visuals, and psychedelic generative art. Activate on "Milkdrop", "music visualization", "WebGL visualizer", "Butterchurn", "audio reactive", "FFT visualization", "spectrum analyzer". NOT for simple bar charts/waveforms (use basic canvas), video editing, or non-audio visuals.

curiositech/windags-skills

Expert legal research agent for finding and scraping expungement data state by state. Knows authoritative sources, URL patterns, Firecrawl configuration, and 2026 legal landscape.

curiositech/windags-skills

Expert in 3D computer vision labeling tools, workflows, and AI-assisted annotation for LiDAR, point clouds, and sensor fusion. Covers SAM4D/Point-SAM, human-in-the-loop architectures, and vertical-specific training strategies. Activate on '3D labeling', 'point cloud annotation', 'LiDAR labeling', 'SAM 3D', 'SAM4D', 'sensor fusion annotation', '3D bounding box', 'semantic segmentation point cloud'. NOT for 2D image labeling (use clip-aware-embeddings), general ML training (use ml-engineer), video annotation without 3D (use computer-vision-pipeline), or VLM prompt engineering (use prompt-engineer).

curiositech/windags-skills

Implement WCAG 2.2 AA/AAA compliance with automated testing, keyboard navigation, screen reader support, and focus management. Activate on: accessibility audit, WCAG compliance, keyboard navigation, screen reader, aria attributes, axe-core, focus trap. NOT for: design-level accessibility review (use design-accessibility-auditor), color contrast only (use css-in-js-architect).

curiositech/windags-skills

Time-blind friendly planning, executive function support, and daily structure for ADHD brains. Specializes in realistic time estimation, dopamine-aware task design, and building systems that actually work for neurodivergent minds.

curiositech/windags-skills

Designs digital experiences for ADHD brains using neuroscience research and UX principles. Expert in reducing cognitive load, time blindness solutions, dopamine-driven engagement, and compassionate design patterns. Activate on 'ADHD design', 'cognitive load', 'accessibility', 'neurodivergent UX', 'time blindness', 'dopamine-driven', 'executive function'. NOT for general accessibility (WCAG only), neurotypical UX design, or simple UI styling without ADHD context.

curiositech/windags-skills

>- Apply crisis decision-making research to agent routing, uncertainty triage, and coordination failure analysis in time-pressured systems. Use when diagnosing handoff failures, analytical paralysis, or expert judgment under incomplete information. NOT for routine coding, simple CRUD design, or static single-agent tasks with complete information.

curiositech/windags-skills

Extend and modify the admin dashboard, developer portal, and operations console. Use when adding new admin tabs, metrics, monitoring features, or internal tools. Activates for dashboard development, analytics, user management, and internal tooling.

curiositech/windags-skills

Conversation patterns and interaction protocols for multi-agent systems. Covers request/response, pub/sub, blackboard, delegation chains, debate, critique, consensus, fan-out/fan-in, supervisor-worker, and peer negotiation. Deep analysis of AutoGen conversation patterns, CrewAI delegation, LangGraph state passing, and FIPA-ACL performatives. Teaches how to design what agents say to each other and in what order. Activate on: "agent conversation", "agent protocol", "multi-agent debate", "agent delegation", "supervisor worker pattern", "agent voting", "consensus protocol", "fan-out fan-in", "agent negotiation", "blackboard pattern", "agent dialogue", "conversation topology", "agent handoff". NOT for: wire format or serialization (use agent-interchange-formats), orchestration infrastructure (use agentic-infrastructure-2026), single agent behavior (use agentic-patterns).

curiositech/windags-skills

Meta-agent for creating new custom agents, skills, and MCP integrations. Expert in agent design, MCP development, skill architecture, and rapid prototyping. Activate on 'create agent', 'new skill', 'MCP server', 'custom tool', 'agent design'. NOT for using existing agents (invoke them directly), general coding (use language-specific skills), or infrastructure setup (use deployment-engineer).

curiositech/windags-skills

AI-powered calendar management and agent-based scheduling coordination. Covers calendar APIs (Google Calendar, CalDAV/iCal), AI scheduling assistants (Reclaim, Clockwise, Motion, Cal.com), building custom calendar agents with MCP, multi-calendar merging, timezone management, focus block protection, meeting fatigue detection, and agent-to-agent meeting negotiation protocols. Activate on: "calendar agent", "AI scheduling", "calendar coordination", "meeting scheduling", "calendar API", "focus time protection", "calendar optimization", "Google Calendar MCP", "Reclaim", "Clockwise", "Motion", "Cal.com", "smart scheduling", "calendar-aware agent", "timezone scheduling", "agent negotiation meetings". NOT for: manual calendar UI component design (use form-validation-architect), project management scheduling or Gantt charts (use project-management-guru-adhd), general time-tracking or pomodoro apps (use adhd-daily-planner for time-awareness), building the agent itself from scratch (use agent-creator).

curiositech/windags-skills

Build and adopt production AI agent infrastructure in 2026. Covers framework selection (LangGraph, CrewAI, AutoGen, MCP), orchestration patterns, evaluation, observability, memory systems, and tool use. Also covers the SOCIAL dimension: how to sell agent infrastructure internally, change management, measuring ROI, building trust in autonomous systems, and scaling adoption across teams. Activate on: "agent infrastructure", "agent framework comparison", "which agent framework", "sell AI tools internally", "agent adoption", "agent observability", "agent evaluation", "MCP architecture", "agentic mesh", "enterprise AI agents", "AI change management", "agent ROI". NOT for: building specific agents (use ai-engineer), designing agent behavior patterns (use agentic-patterns), prompt tuning (use prompt-engineer).

curiositech/windags-skills

Fundamental patterns for effective agentic behavior. Teaches decomposition, tool orchestration, error recovery, context management, quality self-assessment, and knowing when to stop. Model-agnostic principles that make any agent more effective regardless of domain. Activate on: "how should I structure this agent", "agentic workflow", "agent patterns", "multi-step task", "tool orchestration", "/agentic-patterns", "decompose this", "agent best practices", "chain of actions", "when should the agent stop", "agent loop design". NOT for: creating agent infrastructure (use agent-creator), building DAGs (use windags-architect), specific tool implementation.

curiositech/windags-skills

Automated discovery and matching of agent skills for dynamic task routing and capability assessment

curiositech/windags-skills

Cryptographic security for agentic systems — zero-trust agent networking, signed message envelopes (JWS/JWE), capability-based security (ocaps), Merkle tree audit trails, WASM sandboxing, and formal verification. Covers CLI dev tool security, mTLS between agents, permission boundaries (least privilege for AI agents), and supply chain security for skills/plugins. Activate on: "agent security", "zero trust agents", "secure agent communication", "capability-based security", "ocap", "signed messages between agents", "agent audit trail", "sandbox agent execution", "agent permissions", "mTLS agents", "cryptographic verification", "agent supply chain", "OWASP agentic", "prove agent did X", "tamper-proof agent logs". NOT for: application-level SAST scanning (use security-auditor), network firewall rules (use infrastructure), SOC2/HIPAA compliance (organizational), or prompt injection defense (use prompt-engineer).

curiositech/windags-skills

Data structures and serialization formats for agent-to-agent communication. Covers message envelopes, structured output schemas, capability declarations, task handoff payloads, error/retry signaling, and context windows as data structures. Deep comparison of A2A protocol, MCP, OpenAI function calling, and LangChain message types. Teaches when to use rigid schemas vs free-form with validation, typed vs untyped, streaming vs batch. Activate on: "agent message format", "agent communication schema", "agent-to-agent protocol", "A2A protocol", "MCP message format", "structured output for agents", "agent interop", "interchange format", "agent serialization", "task handoff format", "capability declaration". NOT for: what agents say to each other (use agent-conversation-protocols), orchestration topology (use multi-agent-coordination), building agent infrastructure (use agentic-infrastructure-2026).

curiositech/windags-skills

Logic-based agent programming language implementing BDI architecture for practical autonomous agent development

curiositech/windags-skills

>- Design AgentSpeak(L)-style BDI agents with context-guarded plans, selection functions, and intention stacks. Use for interruptible autonomy, agent policy, and multi-agent orchestration in dynamic environments. NOT for simple rule engines, static planners, or centralized workflows.

curiositech/windags-skills

Build production-ready LLM applications, advanced RAG systems, and intelligent agents. Implements vector search, multimodal AI, agent orchestration, and enterprise AI integrations. Use PROACTIVELY for LLM features, chatbots, AI agents, or AI-powered applications.

curiositech/windags-skills

license: Apache-2.0 NOT for unrelated tasks outside this domain.

相关技能