0Pricing
Claude Architect · บทเรียน

โทโพโลยีผู้ประสานงานแบบศูนย์กลางและกิ่งก้าน

ผู้ประสานงานส่วนกลางมอบหมายงานให้เอเจนต์ย่อยผู้เชี่ยวชาญ

โทโพโลยีผู้ประสานงานแบบศูนย์กลางและกิ่งก้าน เป็นบทเรียน Claude Architect ฟรีบน CoddyKit นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Claude Architect และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Claude Architect มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

Why Hub-and-Spoke?

When one agent has to research five sources, review ten files, or juggle a dozen tools, its attention gets diluted and its context window fills with noise. The hub-and-spoke (coordinator) topology fixes this by splitting the work: a central coordinator agent decomposes the task and delegates each slice to a focused specialist subagent.

  • The hub (coordinator) owns the plan: it decomposes, delegates, aggregates, routes, and handles errors.
  • Each spoke (subagent) is a narrow specialist with its own role, system prompt, and a least-privilege tool set.

This is the backbone of the Multi-Agent Research System pattern, and a high-value topic in Domain 1 (Agent Architecture & Orchestration, 27% of the exam).

The Coordinator's Five Jobs

A coordinator is not just a router. On the exam, the correct answer almost always shows the hub doing all five of these jobs:

  • Decompose — break the goal into independent or sequential sub-tasks.
  • Delegate — hand each sub-task to the right specialist.
  • Aggregate — merge subagent results into one coherent answer.
  • Route — decide which specialist (or none) a sub-task needs.
  • Handle errors — recover transient faults, escalate the non-recoverable, and keep partial results.

If a design makes the coordinator a thin pass-through that just forwards text, it is doing too little. If a subagent tries to plan the whole job, it is doing too much.

Delegation Runs Through a Task Tool

In a coordinator agent, delegation is itself a tool call. The coordinator's allowedTools must include "Task" — that is the mechanism it uses to spawn a subagent. Each subagent is described by an AgentDefinition:

  • name — the specialist's identifier.
  • description — when to route to it (the coordinator selects by description, not by name).
  • system_prompt — the specialist's instructions and persona.
  • allowed_tools — a least-privilege list scoped to that role.

Without "Task" in the coordinator's allowed tools, it simply cannot delegate — a common trap answer.

coordinator = AgentDefinition(
    name="research_lead",
    description="Decomposes a research question and delegates to specialists.",
    system_prompt=(
        "You are a research coordinator. Decompose the question, "
        "delegate each part to a specialist via the Task tool, then "
        "aggregate their findings into one cited answer."
    ),
    allowed_tools=["Task"],  # REQUIRED to delegate
)

The #1 Gotcha: No Inherited History

This is the single most-tested fact about hub-and-spoke, so internalize it: subagents do NOT inherit the coordinator's conversation history.

Each subagent starts with a clean context window. It knows only what the coordinator explicitly puts into its prompt. If the coordinator learned a constraint, a date range, a customer ID, or a prior finding, and then delegates without restating it, the subagent is blind to it.

Rule: all context a subagent needs must be passed explicitly in each Task prompt. This is a feature, not a bug — it is exactly what keeps each spoke's context clean and focused.

Passing Context Explicitly

Because nothing is inherited, the coordinator hydrates every Task call with the facts that slice needs. Notice how the customer tier, the date window, and the prior finding are all written into the prompt — not assumed.

# Coordinator delegating one slice to a specialist.
# Everything the subagent needs is in THIS prompt.
task(
    subagent="pricing_analyst",
    prompt=(
        "Context (the subagent cannot see prior turns):\n"
        "- Customer tier: Enterprise\n"
        "- Date window: 2026-01-01 to 2026-03-31\n"
        "- Prior finding: usage spiked 40% in February\n\n"
        "Task: explain the Q1 invoice variance for this account "
        "and cite the source rows you used."
    ),
)

Parallel Fan-Out in One Turn

The coordinator can delegate to several specialists at once. Multiple Task calls emitted in a single response run in parallel. That is how a research coordinator fans out across five sources simultaneously instead of querying them one after another.

  • Use parallel Task calls when sub-tasks are independent (different sources, different files, different regions).
  • Use sequential delegation when a later step depends on an earlier result (a fixed pipeline / prompt chain).

Independent workstreams in parallel; dependent steps in sequence.

# Three independent searches fan out in ONE response -> they run in parallel.
results = [
    task(subagent="web_researcher",   prompt="Find 2026 EV adoption stats. Cite URLs + dates."),
    task(subagent="filings_analyst", prompt="Pull Q4 EV revenue from 10-K filings. Cite the filing."),
    task(subagent="news_scanner",    prompt="Summarize EV policy news this quarter. Cite each source."),
]

Scope Each Spoke's Tools

Specialists earn their reliability from a tight tool surface. The fact sheet is blunt about this: 4–5 tools per agent is optimal, and 18+ tools degrades selection reliability. Overlapping or ambiguous tool descriptions cause misrouting.

So scope tools to the role and follow least privilege:

  • A read-only researcher gets search/fetch tools — never write or delete.
  • A refund agent gets process_refund — but not the database admin tools.

Remember: the model picks a tool from its description, not its name. A good description states purpose, return values, input formats with examples, edge cases, and applicability boundaries.

web_researcher = AgentDefinition(
    name="web_researcher",
    description="Searches the public web and fetches page content. "
                "Use for current events and external facts. Read-only.",
    system_prompt="Find evidence and return quotes with source URLs and dates.",
    allowed_tools=["web_search", "web_fetch"],  # least privilege, no writes
)

Aggregating With Provenance

When the spokes report back, the coordinator's aggregation step does more than concatenate. For a research system it must preserve provenance — the claim-to-source mapping (URL or doc name, the quote, and the publication date).

  • When two subagents return conflicting stats, annotate the conflict rather than silently picking one. Publication dates often resolve the apparent contradiction.
  • Render by content type: tables for financials, prose for news, lists for technical findings.

Silent suppression of a disagreement is a wrong answer; surfaced, dated, cited disagreement is the right one.

Errors: Recover Local, Escalate Hard

One failing spoke must not abort the whole workflow. The coordinator distinguishes failure types and acts accordingly:

  • Transient fault (timeout, rate limit) — recover locally inside the subagent; retry there.
  • Non-recoverable — escalate to the coordinator with partial results so the rest of the job still completes.
  • Distinguish an access FAILURE (worth retrying) from a valid EMPTY result (genuinely no matches — do not retry).

This is why structured errors matter: a generic "Operation failed" blocks recovery, while a structured error (failure type, attempted query, partial results, alternatives, retryable flag) lets the coordinator route intelligently. Never silently suppress; never abort the whole run on one spoke's failure.

# A subagent reports a structured failure so the hub can route, not abort.
return {
    "is_error": True,
    "error_category": "transient",      # transient | validation | business | permission
    "is_retryable": True,
    "message": "Source timed out after 3 attempts",
    "attempted_query": "EV adoption 2026 site:iea.org",
    "partial_results": [{"source": "iea.org", "note": "1 of 3 pages fetched"}],
}

Context Isolation Is the Payoff

Why pay the cost of multiple agents at all? Context isolation. Each spoke runs in its own clean context window, so verbose tool output from one specialist never crowds out another's reasoning.

  • It defends against lost-in-the-middle: models attend most to the start and end of a context, so keeping each spoke's window short and on-topic keeps key facts in the high-attention zones.
  • Trim verbose subagent tool output to the relevant fields before it reaches the coordinator.

A single mega-agent doing everything in one window is exactly the anti-pattern hub-and-spoke is designed to replace.

Terminate on Stop Reason, Not Text

The coordinator drives each delegation through the standard agentic loop, and the exam is strict about how it ends. Terminate on the model's stop_reason, never by parsing the text for words like "done".

  • Inspect stop_reason: on tool_use, run the tool (or Task) and append results; on end_turn, the turn is complete.
  • Decisions are model-driven. An iteration cap is a safety net, never the primary stop mechanism.

Parsing output text for a completion signal, or using a hard iteration cap as the main exit, are classic distractor answers.

while True:
    resp = client.messages.create(model="claude-opus-4-8", max_tokens=4096,
                                  messages=messages, tools=tools)
    if resp.stop_reason == "end_turn":
        break                       # complete -> stop on the stop_reason
    if resp.stop_reason == "tool_use":
        messages.append({"role": "assistant", "content": resp.content})
        messages.append({"role": "user", "content": run_tasks(resp)})
    # an iteration cap would be a SAFETY NET here, not the primary exit

Quick Check: Delegation Done Right

A coordinator agent has already learned, in earlier turns, that the user only wants results for the EU region in 2026. It now fans out three parallel Task calls to specialist subagents to gather data. What MUST the coordinator do for the subagents to apply that EU/2026 constraint?

Recap: The Coordinator Topology

Key takeaways for the exam:

  • Shape: one coordinator (hub) decomposes, delegates, aggregates, routes, and handles errors; specialist subagents (spokes) do focused work.
  • Delegation: the coordinator's allowedTools must include "Task"; each spoke is an AgentDefinition with name, description, system_prompt, and least-privilege allowed_tools.
  • No inherited history: pass ALL needed context explicitly in every Task prompt.
  • Parallelism: multiple Task calls in one response run in parallel — use it for independent work; sequence dependent steps.
  • Tools: 4–5 per spoke is optimal; route by description; scope to the role.
  • Aggregation: keep provenance, annotate conflicts (dates resolve them), render by content type.
  • Errors: recover transient locally, escalate non-recoverable with partial results, never abort the whole run.
  • Termination: stop on stop_reason, never on parsed text; iteration caps are a safety net only.

คำถามที่พบบ่อย

บทเรียน “โทโพโลยีผู้ประสานงานแบบศูนย์กลางและกิ่งก้าน” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “โทโพโลยีผู้ประสานงานแบบศูนย์กลางและกิ่งก้าน” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Claude Architect ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Claude Architect มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “โทโพโลยีผู้ประสานงานแบบศูนย์กลางและกิ่งก้าน”

ผู้ประสานงานส่วนกลางมอบหมายงานให้เอเจนต์ย่อยผู้เชี่ยวชาญ คุณปฏิบัติ Claude Architect ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Claude Architect หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Claude Architect บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน

บทเรียน “โทโพโลยีผู้ประสานงานแบบศูนย์กลางและกิ่งก้าน” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน Claude Architect นี้ได้ไหม

ได้ บทเรียน Claude Architect ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. โทโพโลยีผู้ประสานงานแบบศูนย์กลางและกิ่งก้าน
  2. หน้าที่ของผู้ประสานงาน
  3. เอเจนต์ย่อยไม่สืบทอดประวัติ
  4. การสร้างเอเจนต์ย่อยแบบขนาน
← กลับไปที่ Claude Architect