For complex projects, a single agent may not be enough. Claude Code supports orchestrating multiple agents working in parallel, each specializing in a different area.
Với các dự án phức tạp, một agent có thể không đủ. Claude Code hỗ trợ điều phối nhiều agent làm việc song song, mỗi agent chuyên về một lĩnh vực khác nhau.
Team orchestration allows you to divide work into independent tasks, assign them to appropriate agents, and combine results into a complete product.
Team orchestration cho phép bạn chia công việc thành các task độc lập, phân công cho các agent phù hợp, và tổng hợp kết quả thành sản phẩm hoàn chỉnh.
Specializes in system architecture design, requirements analysis, and implementation planning. Uses Opus model for deep analysis.
Chuyên về thiết kế kiến trúc hệ thống, phân tích yêu cầu và tạo kế hoạch triển khai. Sử dụng Opus model cho phân tích sâu.
Performs specific tasks like writing code, creating files, running commands. Can use Haiku (simple), Sonnet (medium), or Opus (complex).
Thực hiện các task cụ thể như viết code, tạo file, chạy lệnh. Có thể dùng Haiku (đơn giản), Sonnet (trung bình), hoặc Opus (phức tạp).
Reviews code to find bugs, best practice violations, and performance issues. Provides structured feedback with severity ratings.
Review code để tìm bugs, vi phạm best practices và vấn đề performance. Cung cấp feedback có cấu trúc với severity rating.
Specializes in finding security vulnerabilities per OWASP Top 10, exposed secrets, and unsafe patterns.
Chuyên tìm lỗ hổng bảo mật theo OWASP Top 10, secrets bị lộ, và các pattern không an toàn.
1# Create a team for a project2/team create "feature-auth"34# Team will:5# 1. Create shared task list6# 2. Spawn specialized agents7# 3. Coordinate work in parallel8# 4. Report back when complete910# Example team workflow:11Leader: Creates tasks, assigns to agents12Agent 1 (Executor): Implements backend API13Agent 2 (Executor): Implements frontend UI14Agent 3 (Reviewer): Reviews completed workAgents in a team share a task list. Each agent can claim tasks, mark them complete, and create new tasks when additional work is discovered.
Các agent trong team chia sẻ một task list. Mỗi agent có thể claim task, đánh dấu hoàn thành, và tạo task mới khi phát hiện công việc cần làm thêm.
1# Task list example2#1. [in_progress] Create user schema (owner: agent-1)3#2. [pending] Add login endpoint4#3. [pending] Add signup endpoint5#4. [blocked] Add OAuth - blocked by #2, #36#5. [completed] Setup database migrationsWhen tasks don't depend on each other, they can be executed in parallel by different agents, significantly speeding up completion.
Khi các task không phụ thuộc lẫn nhau, chúng có thể được thực hiện song song bởi các agent khác nhau, tăng tốc độ hoàn thành đáng kể.
1# Independent tasks run in parallel:2┌──────────────────────────────────────────┐3│ Time │ Agent 1 │ Agent 2 │4├───────┼──────────────┼───────────────────┤5│ 0:00 │ User API │ Product API │6│ 0:05 │ User tests │ Product tests │7│ 0:08 │ (idle) │ (idle) │8└──────────────────────────────────────────┘910# Sequential: 0:1611# Parallel: 0:08 (2x faster)Agents communicate through the SendMessage tool. Leader agent coordinates and agents report progress.
Các agent giao tiếp thông qua SendMessage tool. Leader agent điều phối và các agent báo cáo tiến độ.
1# Agent communication2Leader → Agent-1: "Implement user registration API"3Agent-1 → Leader: "Task complete, created POST /users"4Leader → Agent-2: "User API ready, you can start frontend"Agent leader nên kiểm tra progress thường xuyên và điều chỉnh kế hoạch nếu cần.
- Large projects with multiple independent modules.
Dự án lớn với nhiều module độc lập.
- Need different expertise (code, review, security).
Cần nhiều chuyên môn khác nhau (code, review, security).
- Want to speed up through parallel execution.
Muốn tăng tốc độ thông qua parallel execution.
Key Takeaways
Điểm Chính
- Teams coordinate multiple specialized agents working in parallelTeams điều phối nhiều agent chuyên biệt làm việc song song
- Shared task list keeps everyone synchronizedTask list chung giữ mọi người đồng bộ
- Independent tasks run in parallel for faster completionCác task độc lập chạy song song để hoàn thành nhanh hơn
- Use teams for large projects with multiple modulesDùng teams cho dự án lớn với nhiều module
Practice
Test your understanding of this chapter
What is the main benefit of multi-agent orchestration?
Lợi ích chính của multi-agent orchestration là gì?
All tasks in a team must be executed sequentially.
Tất cả task trong team phải được thực hiện tuần tự.
Complete the command to create a new team
Hoàn thành lệnh để tạo team mới
/team "project-name"
Which agent specializes in finding security vulnerabilities?
Agent nào chuyên tìm lỗ hổng bảo mật?