Self-Improving Agent
一个面向 Automation 场景的 Agent 技能。原始说明:Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects Clau...
一个面向 Automation 场景的 Agent 技能。原始说明:Cross-framework enhancement overlay for choosing a multi-agent topology BEFORE writing any agent. A binary-question rubric — is single-agent + tools enough?...
name: agentsop-agent-topology-selection
version: 0.1.0
description: >-
Cross-framework enhancement overlay for choosing a multi-agent topology BEFORE writing any
agent. A binary-question rubric — is single-agent + tools enough? do agents need to know
about each other? does the output need one voice? — maps the answer to single-agent /
supervisor / swarm / sequential / hierarchical. Activates when a coder agent is tempted to
"split the work into roles" or reaches for a multi-agent framework. Encodes the *selection
rubric* that the per-framework skills assume but never surface. Search keywords: when to
use multi-agent, single vs multi agent, do I need multiple agents, supervisor vs swarm,
multi-agent vs single agent, agent team design.
overlay: true
cross_links: [crewai, langgraph, bounded-loop]
Overlay posture: this skill decides whether and which topology. It does not
teach the API — descend to
[[crewai]]or[[agentsop-langgraph]]for that. Every
load-bearing claim carries an inline source tag resolving in
references/R1-source-evidence.md.
Activate when any of the following fire:
"manager agent", "agents that hand off", "split this into roles", or "multi-agent".
Agent(...) × N, LangGraph supervisor/swarm, OpenAI Swarm handoffs) and has not yet justified
why a single agent with tools is insufficient.
Process.sequential vs Process.hierarchical, or LangGraph supervisor vs swarm vs hierarchical-teams, and wants the rubric,
not the syntax.
collapse agents back into one?".
Do not activate for: a single LLM call, a one-shot RAG query, or a fixed
tool-call pipeline with no role separation. Those are the single-agent baseline
this skill defends.
Mental check: "An agent needs agency, otherwise it's just another script."
— João Moura, CrewAI founder
[[crewai · §1.3]]. If you can write the control
flow in
if/else, you do not need multiple agents — you need one agent (or a
graph) with explicit edges.
Most "multi-agent" problems are single-agent + tools. Add agents only when
context isolation or parallel expertise genuinely demands it.
"Single-agent is right for approximately 80% of cases; the trap is reaching for
multi-agent because it sounds more capable."
[[crewai · DC-1]]
Two — and only two — forces justify a second agent:
(a critic that must not see its own draft's rationalisations; a tool-heavy
sub-task whose 40 intermediate tool calls should not bloat the main thread).
Splitting gives each agent a clean, bounded prompt.
strict sequence (research → write → review), where a single prompt provably
cannot hold both jobs without quality collapse [[crewai · DC-1]].
If neither force is present, a single agent with the union of tools wins —
fewer hops, fewer tokens, no handoff failures. This is the baseline the rubric
must beat, not the default to escape.
Q0 Is single-agent + tools enough?
(no context-isolation need, no parallel-expertise need)
YES → single-agent + tools. STOP. Do not add agents.
NO → ↓
Q1 Do the agents need to KNOW ABOUT EACH OTHER (peer handoff)?
NO → one funnels through a coordinator → SUPERVISOR
(or static order → SEQUENTIAL, if order is fixed)
YES → ↓
Q2 Must the OUTPUT speak with ONE VOICE / single audit funnel?
YES → SUPERVISOR (single user-facing persona, one funnel)
NO → SWARM (dynamic peer handoff, last-active agent remembered)
Scaling override: ≥6 specialists that group into teams → HIERARCHICAL
(supervisor-of-supervisors). Use only for grouping, not for routing.
The two questions that actually separate the patterns: (a) can sub-agents know
each other, (b) is one user-facing voice mandated. Everything else is tuning[[langgraph · Case 2]].
Walk top-down. Each gate can send you back down the ladder — collapsing agents
is as valid an answer as adding them.
Ask Q0. Enumerate the would-be roles. For each, ask: *would merging it into one
agent's prompt + toolset actually degrade output?* If you cannot point to a
concrete failure mode (style drift, missed checklist, context bloat, parallel
latency), the honest answer is single-agent + tools. Exit here ~80% of the time[[crewai · DC-1]].
precedes review) → SEQUENTIAL. Cheapest, most debuggable, 1× token baseline
[[crewai · §2.3]]. In CrewAI this is Process.sequential; in LangGraph it is
static edges A→B→C.
you need a coordinator or peer handoff → continue to Step 3.
Ask Q1 then Q2.
SUPERVISOR. Sub-agents are effectively tools the supervisor calls; the
supervisor "translates" their output back to the user — which is exactly why
it costs the most tokens [[langgraph · Step 4]].
SWARM. Dynamic handoff, last-active agent stays active across turns, no
translation step → fewer tokens, slightly higher accuracy on the τ-bench retest
[[langgraph · §SOP Step 4]].
LangChain's own benchmark found swarm "slightly outperformed supervisor across
all scenarios" and supervisor "consistently uses more tokens than swarm" — yet
they still ship supervisor as the recommended default [[langgraph · Step 4]].
Why the nuance matters:
single audit log, single place to enforce policy) [[langgraph · Step 4]].
no central control point [[langgraph · Step 4]].
and trusted, swarm is often the better pick the default hides. Pick on the two
questions, not on the framework's default.
Any topology with runtime handoff (swarm, hierarchical, CrewAI delegation) can
loop. Bound it before shipping — cross-link [[agentsop-bounded-loop]]. Concretely:
default allow_delegation=False on workers, set per-agent max_iter, wrap an
outer timeout, and bake an explicit exit counter into state rather than trusting
the LLM to stop [[crewai · DC-5]] [[agentsop-bounded-loop]].
≥6 specialists → group into HIERARCHICAL teams purely for navigability, not
to get free routing (see Anti-patterns). At >5 agents CrewAI starts hitting
coordination failure [[crewai · §6.1]]; that is a signal to group or collapse,
not to add more.
Format: Trigger → Action → Output → Evidence.
merging into one agent would cause (style drift / missed checklist / context
bloat / required parallelism). No nameable failure ⇒ single agent.
[[crewai · DC-1]] "single-agent right for ~80% of cases".failure mode.
not "it sounds more capable". If only the latter, stay single.
[[crewai · §2.2]], [[crewai · DC-1]]. explicitly (CrewAI context=[...]), do not rely on implicit transfer.
Process.sequential or LangGraph staticedges.
[[crewai · §2.3]] (sequential = 1× tokens, low debug cost).YES ⇒ continue to OP-5.
[[langgraph · Step 4]] decision tree.SUPERVISOR; NO ⇒ SWARM.
[[langgraph · Case 2]] (compliance ⇒ supervisor; UX continuity ⇒ swarm).default.
Internal/trusted ⇒ re-test whether swarm's lower token cost wins; if so, switch.
[[langgraph · Step 4]] — swarm beats supervisor on bench, yetsupervisor remains the shipped default for third-party safety.
one. For supervisor: remove handoff messages, add a forwarding-messages tool,
optimise tool naming — LangChain measured "nearly 50% increase in performance"
[[langgraph · Step 4]]. Switch paradigm only if still over budget.
[[langgraph · Case 2]].allow_delegation=False on workers, per-agent max_iter, outertimeout, explicit state-based exit counter.
[[crewai · DC-5]] (delegation ping-pong), [[agentsop-bounded-loop]]. outperformed supervisor across all scenarios" and supervisor "consistently uses
more tokens" (the telephone-game translation overhead). Yet LangChain's
recommended default is still supervisor [[langgraph · Step 4]]. A coder
agent copying the default would leave accuracy and tokens on the table.
third-party agents and single audit funnel** — not on accuracy [[langgraph · Step 4]].
pick swarm; the default does not apply to you.
three fixes (remove handoff messages, forwarding-messages tool, tool-name
tuning) for the measured ~50% bump before concluding it is too slow
[[langgraph · Case 2]].
tolerant.
supervisor" is true and the supervisor default is rational — for a different
constraint (third-party safety) than the one the benchmark measured (accuracy/cost).
worst-case constraint, not yours. Decode the reason; re-derive for your case.**
irrelevant specialists based on the query. Process.hierarchical looks like it
"should auto-route". In practice the manager executes all tasks and the last
task's output overwrites the rest — it does not skip on triage [[crewai · DC-2]].
Query: "Why is my laptop overheating?" (pure technical)
Expected: triage → technical_agent → done
Hierarchical reality: triage → technical → billing → … → last output wins
manager_llm is unreliable; latency/costmatter.
coordination topology, not a router [[crewai · DC-2]].
@router / @listen) or a LangGraph conditional edge — explicit branch, then call
one small crew / single agent per branch [[crewai · DC-2]].
custom manager_agent** carrying an explicit branching backstory — never
the bare default manager_llm [[crewai · OP-4]].
allow_delegation=False, outer timeout [[agentsop-bounded-loop]].true coordination of trusted teams, never for if/else routing.
explicit (Flow / conditional edge), don't delegate it to a manager LLM that will
run everything.** Compare with d-query-routing-skill for the routing-specific rubric.
with no context-isolation or parallel-expertise force. Symptom: agents that just
pass a string along, each adding a paragraph. Fix: collapse to one agent + tools
[[crewai · DC-1]].
Process.hierarchical (or a supervisor) to get free if/else routing. It runs everything; routing must be
explicit control flow (Flow / conditional edge) [[crewai · DC-2]].
accuracy and tokens; supervisor is the default for third-party safety. Internal
trusted agents should reconsider swarm [[langgraph · Step 4]].
≥6 ⇒ group into hierarchical teams for navigability, or merge near-duplicate
roles [[crewai · §6.1]].
allow_delegation=True on every agent ⇒ ping-pong loops. Default off on workers; bound with max_iter + timeout [[crewai · DC-5]],
[[agentsop-bounded-loop]].
cleaner" instead of the two binary questions (peer-awareness, single-voice)
[[langgraph · Case 2]].
Hard boundaries (this rubric does NOT decide):
[[crewai]] vs [[agentsop-langgraph]] ecosystem sections.d-query-routing-skill.[[agentsop-bounded-loop]]. [[langgraph · 反模式]].
| Topology | CrewAI | LangGraph | OpenAI Swarm | Choose when |
|---|---|---|---|---|
| Single-agent + tools | one Agent + tools (skip Crew) | create_react_agent | one routine | Q0=YES — ~80% of cases [[crewai · DC-1]] |
| Sequential | Process.sequential + context=[...] | static edges A→B→C | linear handoffs | order fixed at design time [[crewai · §2.3]] |
| Supervisor | Process.hierarchical + custom manager_agent | supervisor pattern (sub-agents as tools) | central routine dispatching | peers don't know each other; one voice / third-party safety [[langgraph · Step 4]] |
| Swarm | (no native; Flow + handoff funcs) | swarm pattern (dynamic handoff) | handoff between agents | peers know each other; no single-voice mandate; internal/trusted [[langgraph · Step 4]] |
| Hierarchical teams | nested crews via Flow | supervisor-of-supervisors / subgraphs | n/a | ≥6 specialists needing grouping [[crewai · §6.1]] |
Notes:
hierarchical is coordination, not routing — the default manager_llm runs all tasks [[crewai · DC-2]].
shipped default for third-party safety despite swarm winning the bench
[[langgraph · Step 4, Case 2]].
use as reference, not production [[langgraph · 生态对照]].
first (OP-1).
Pick the smallest topology that fits the two questions; promote upward only when a
named force demands it, and collapse back down when the force disappears.
Inline tags resolve to source-skill sections in references/R1-source-evidence.md:
[[crewai]] = /Users/5imp1ex/Desktop/Skill-Workplace/output/crewai-sop-skill/SKILL.md[[agentsop-langgraph]] = /Users/5imp1ex/Desktop/Skill-Workplace/output/langgraph-sop-skill/SKILL.md (www.langchain.com/blog/benchmarking-multi-agent-architectures), surfaced via
[[langgraph · Step 4 / Case 2]].