正在学习

9.1 Multi-Agent and Subagent Workflows

Main agent workflow

task_description = "Build a FastAPI endpoint for creating tasks."

plan = planner.respond(f"Please plan steps to {task_description}")

implementation = coder.respond(f"Implement the plan: {plan}")

review = reviewer.respond(f"Review this code: {implementation}")

Simulate result aggregation

project_summary = {

"Task": task_description,

"Plan": plan,

"Code": implementation,

"Review": review

}

for k, v in project_summary.items():

print(f"{k}: {v}\n")

This simulation demonstrates the core idea of multi-agent orchestration—each Claude instance performs its role independently but feeds into a shared state. In practice, you could replace the respond() method with real API calls and add message routing via queues, HTTP endpoints, or workflow engines.

Clarification Table: Multi-Agent Roles and Responsibilities

| Agent Role | Primary Function | Input | Output |
| --- | --- | --- | --- |
| Planner | Breaks down goals into actionable steps | User requirements | Task list or workflow plan |
| Coder | Implements logic based on Planner output | Technical plan | Source code or scripts |
| Reviewer | Evaluates correctness, clarity, and security | Generated code | Annotated feedback or approval |
| Deployer | Runs and verifies deployment process | Reviewed code | Running application and logs |

Multi-agent and subagent workflows allow Claude to scale beyond a single conversational interface into a collaborative ecosystem of specialized assistants. This structure mirrors real-world engineering teams and allows AI systems to reason, execute, and verify at scale.

In the next section, you’ll take this architecture further by building a Claude-Powered Team Assistant, where multiple Claude agents share memory and context dynamically to manage software projects in real time—automating the equivalent of a full sprint cycle.

## 9.2 Creating Internal Developer Tools with Claude
Every modern engineering team depends on internal tools — dashboards, automation scripts, linters, CI pipelines, and documentation generators — to streamline their daily workflows. These tools are essential for productivity but are often neglected because building and maintaining them consumes valuable engineering hours. Claude Code can change that equation entirely. With Claude’s reasoning and generation capabilities, you can design, implement, and maintain internal tools faster than ever, while ensuring consistent quality and compliance.

In this section, you’ll learn how to build internal developer tools powered by Claude, such as automated changelog generators, test coverage reporters, and internal API monitors. You’ll also understand how to integrate Claude’s outputs directly into your development process without external dependencies or complex orchestration layers.

Concept Development

Internal tools typically share three common characteristics:

1. They automate repetitive tasks — things developers do daily like formatting, code validation, and reporting.
2. They require access to project data — repositories, build logs, issue trackers, or CI/CD pipelines.
3. They must evolve with the codebase — as your stack changes, the tool must adapt.

Claude excels at these characteristics because it can read structured input (like commit diffs or logs), infer intent, and generate the corresponding tool or output dynamically. It bridges reasoning and execution by transforming context into actionable automation.

Common use cases include:

- Code Quality Auditors– scanning for anti-patterns and inconsistent naming.
- Changelog Generators– summarizing commits into user-friendly updates.
- Onboarding Assistants– generating documentation or setup scripts from source files.
- Release Validators– checking semantic versioning, dependency updates, and breaking changes before deployment.

Let’s see how Claude can help create one of these internal tools — an automated changelog generator — that summarizes Git commits and outputs a clean Markdown changelog with categorized sections.

# Hands-On Example: Building a Claude-Powered Changelog Generator
This example demonstrates a Python CLI tool that uses Claude to generate structured release notes based on Git commit history. The script can be run locally or integrated into your CI pipeline.

```python
import subprocess
import json
from datetime import datetime

练习题

What is the first step in the main agent workflow for building a FastAPI endpoint?

A. Implement the plan
B. Review the code
C. Plan steps to build the endpoint
D. Deploy the application

Which component of the project summary contains the actual code implementation?

A. Task
B. Plan
C. Code
D. Review

What are the roles of the agents in the multi-agent orchestration workflow? (Select all that apply)

A. Planner
B. Coder
C. Reviewer
D. Deployer
E. Manager

The main agent workflow involves each Claude instance performing its role independently but feeding into a shared state.

The _____ breaks down goals into actionable steps based on user requirements.

What is the purpose of the Reviewer in the multi-agent workflow?

Which agent is responsible for running and verifying the deployment process?

A. Planner
B. Coder
C. Reviewer
D. Deployer

Internal tools must evolve with the codebase as the stack changes.

Claude excels at creating internal tools because it can read structured input, infer intent, and generate the corresponding _____ dynamically.

What is the purpose of a Claude-powered changelog generator?

Which of the following are common use cases of internal tools with Claude? (Select all that apply)

A. Code Quality Auditors
B. Changelog Generators
C. Onboarding Assistants
D. Release Validators
E. Database Managers

Which knowledge point describes the characteristics of internal tools?

A. kp_9_1_1
B. kp_9_1_2
C. kp_9_2_2
D. kp_9_2_3

The Deployer is responsible for writing functional code for each task.

The _____ evaluates the logic, readability, and security of the generated code.

What are the three common characteristics of internal tools?

In a multi-agent workflow, which agent is primarily responsible for transforming user requirements into an actionable task list?

A. Coder
B. Reviewer
C. Planner
D. Deployer

Which components are essential for a complete project summary in a multi-agent workflow? (Select all that apply)

A. Task description
B. Implementation logs
C. Plan
D. Code
E. Review feedback
F. Deployment status

The ___ agent is responsible for evaluating the correctness, clarity, and security of the generated code before it proceeds to deployment.

Explain how the Planner and Coder agents collaborate in a multi-agent workflow to transform user requirements into functional code.

登录后解锁笔记、知识点解析、AI 问答

立即登录