The standalone prototype should be the root-level project shape for fengqun while preserving the existing planning documents already at the root. This keeps README, examples, tests, and the Python package directly discoverable without deleting the prior docs. Constraint: User clarified that swarm-minimal is the repository root, but other existing root files must remain. Rejected: Deleting existing root docs | They are part of the fengqun repository context and were explicitly protected. Confidence: high Scope-risk: narrow Directive: Keep secrets in ignored .env only; do not commit live credentials. Tested: python3 -B -m unittest discover -s tests; git diff --check; secret-pattern scan showed only placeholders/test values/task-id false positives. Not-tested: Remote web UI rendering after push.
3.0 KiB
3.0 KiB
Swarm Behavior Test Matrix
This matrix tests swarm behavior itself, not security compliance. Its primary basis is the Juejin article "Agent 蜂群模式(Swarm)": decentralized behavior, self-organization, emergence, robustness, scalability, implicit collaboration, and the initialize/perceive/decide/interact/converge loop. LangGraph Swarm is used only as a handoff reference, not as the main swarm standard.
Core Swarm Claims
| Claim | Why It Matters | Observable Evidence |
|---|---|---|
| Fault isolation | A swarm should not lose the whole result when one Agnet fails. | A failed agent produces a failed observation while other agents still complete and convergence is written. |
| Stigmergy / pheromone coordination | Agents should coordinate indirectly through the shared environment, not only through a central planner. | Pheromone score changes claim order and later convergence preference. |
| Emergent consensus | Group-level output should be stronger than any single local signal in selected scenarios. | Multiple local weak signals aggregate into the accepted result even though no single weak signal is the strongest individual observation. |
| Handoff continuity | LangGraph-style swarm handoff must preserve control target and context across active agents. | transfer_to_<agent> naming, active-agent state changes, and payload continuity are checked step by step. |
Scenarios
| ID | Scenario | Given | When | Then | Different From |
|---|---|---|---|---|---|
| B01 | Single Agnet failure isolation | Three competing route tasks; one Agnet always raises | The swarm coordinator runs to convergence | The failed task is recorded, two alternative tasks finish, and the accepted output comes from a healthy Agnet | Failure handling, not normal success |
| B02 | Emergent consensus from local evidence | Several local evidence tasks, where no single weak signal beats the strongest individual alternative | Agents update shared state with local candidate evidence | The accumulated candidate wins through shared-state aggregation | Emergence, not simple highest single answer |
| B03 | Pheromone-biased task selection | Multiple pending tasks with different pheromone values | Agents claim tasks through the shared task pool | The highest pheromone task is claimed first and positive feedback is recorded | Indirect coordination, not explicit handoff |
| B04 | LangGraph-style handoff continuity | Collector, analyst, and reporter agents with shared active-agent state | Each stage writes a transfer_to_<agent> handoff and payload |
The next agent observes the previous handoff, continues context, and final convergence uses the reporter output | Control transfer, not parallel competition |
Passing Bar
The behavior acceptance result is PASS only if all B01-B04 scenarios pass. A passing run proves the current prototype has minimal swarm behavior under deterministic conditions. It does not prove large-scale production performance, Byzantine-agent resistance, or certified LangGraph package compatibility.