@musashishao/agent-kit 1.8.2 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent/agents/ai-architect.md +39 -0
- package/.agent/agents/ai-asset-factory.md +700 -0
- package/.agent/agents/ai-audio-factory.md +503 -0
- package/.agent/agents/cloud-engineer.md +39 -0
- package/.agent/agents/game-developer.md +190 -89
- package/.agent/agents/marketing-specialist.md +41 -0
- package/.agent/agents/orchestrator.md +113 -3
- package/.agent/agents/penetration-tester.md +15 -1
- package/.agent/agents/project-planner.md +67 -0
- package/.agent/agents/unity-mobile-master.md +949 -0
- package/.agent/mcp/config/registry.json +65 -51
- package/.agent/mcp/servers/notebooklm/README.md +114 -0
- package/.agent/mcp/servers/notebooklm/package.json +35 -0
- package/.agent/mcp/servers/notebooklm/src/auth/chrome.ts +225 -0
- package/.agent/mcp/servers/notebooklm/src/auth/index.ts +1 -0
- package/.agent/mcp/servers/notebooklm/src/index.ts +516 -0
- package/.agent/mcp/servers/notebooklm/src/services/index.ts +3 -0
- package/.agent/mcp/servers/notebooklm/src/services/library.ts +217 -0
- package/.agent/mcp/servers/notebooklm/src/services/notebooklm.ts +380 -0
- package/.agent/mcp/servers/notebooklm/tsconfig.json +15 -0
- package/.agent/mcp-gateway/README.md +169 -20
- package/.agent/mcp-gateway/package.json +22 -7
- package/.agent/mcp-gateway/src/auth/index.ts +55 -0
- package/.agent/mcp-gateway/src/auth/middleware.ts +242 -0
- package/.agent/mcp-gateway/src/auth/oauth.ts +462 -0
- package/.agent/mcp-gateway/src/auth/scopes.ts +227 -0
- package/.agent/mcp-gateway/src/index.ts +252 -105
- package/.agent/mcp-gateway/src/observability/index.ts +5 -0
- package/.agent/mcp-gateway/src/observability/otel.ts +405 -0
- package/.agent/mcp-gateway/src/transports/index.ts +5 -0
- package/.agent/mcp-gateway/src/transports/streamableHttp.ts +235 -0
- package/.agent/rules/CODEX.md +115 -2
- package/.agent/rules/CODE_RULES.md +73 -0
- package/.agent/rules/GEMINI.md +26 -1
- package/.agent/rules/MEMORY_STATE.md +110 -0
- package/.agent/rules/REFERENCE.md +40 -58
- package/.agent/rules/REF_SKILLS.md +116 -0
- package/.agent/rules/REF_WORKFLOWS.md +81 -0
- package/.agent/scripts/ak_cli.py +106 -5
- package/.agent/scripts/memory_manager.py +48 -9
- package/.agent/skills/3d-web-experience/SKILL.md +386 -0
- package/.agent/skills/DEPENDENCIES.md +54 -0
- package/.agent/skills/ab-test-setup/SKILL.md +77 -0
- package/.agent/skills/active-directory-attacks/SKILL.md +59 -0
- package/.agent/skills/agent-evaluation/SKILL.md +430 -0
- package/.agent/skills/agent-memory-systems/SKILL.md +426 -0
- package/.agent/skills/agent-tool-builder/SKILL.md +139 -0
- package/.agent/skills/ai-agents-architect/SKILL.md +115 -0
- package/.agent/skills/ai-product/SKILL.md +86 -0
- package/.agent/skills/ai-wrapper-product/SKILL.md +90 -0
- package/.agent/skills/analytics-tracking/SKILL.md +88 -0
- package/.agent/skills/anti-hallucination/SKILL.md +295 -0
- package/.agent/skills/anti-hallucination/scripts/check_hallucination.py +299 -0
- package/.agent/skills/api-fuzzing-bug-bounty/SKILL.md +66 -0
- package/.agent/skills/app-store-optimization/SKILL.md +66 -0
- package/.agent/skills/autonomous-agent-patterns/SKILL.md +414 -0
- package/.agent/skills/aws-penetration-testing/SKILL.md +50 -0
- package/.agent/skills/aws-serverless/SKILL.md +327 -0
- package/.agent/skills/azure-functions/SKILL.md +340 -0
- package/.agent/skills/bifurcation-analysis/SKILL.md +56 -0
- package/.agent/skills/brainstorming/SKILL.md +80 -6
- package/.agent/skills/broken-authentication/SKILL.md +53 -0
- package/.agent/skills/browser-automation/SKILL.md +408 -0
- package/.agent/skills/browser-extension-builder/SKILL.md +422 -0
- package/.agent/skills/bullmq-specialist/SKILL.md +424 -0
- package/.agent/skills/bun-development/SKILL.md +386 -0
- package/.agent/skills/burp-suite-testing/SKILL.md +60 -0
- package/.agent/skills/clerk-auth/SKILL.md +432 -0
- package/.agent/skills/cloud-penetration-testing/SKILL.md +51 -0
- package/.agent/skills/copywriting/SKILL.md +66 -0
- package/.agent/skills/crewai/SKILL.md +470 -0
- package/.agent/skills/decision-memory/SKILL.md +317 -0
- package/.agent/skills/discord-bot-architect/SKILL.md +447 -0
- package/.agent/skills/email-sequence/SKILL.md +73 -0
- package/.agent/skills/emergence-detector/SKILL.md +230 -0
- package/.agent/skills/emergence-detector/scripts/check_emergence.py +265 -0
- package/.agent/skills/ethical-hacking-methodology/SKILL.md +67 -0
- package/.agent/skills/explained-qa/SKILL.md +142 -0
- package/.agent/skills/explained-qa/game-terminology.md +214 -0
- package/.agent/skills/firebase/SKILL.md +377 -0
- package/.agent/skills/game-development/ai-dialogue-engine/SKILL.md +442 -0
- package/.agent/skills/game-development/ai-graphics-generator/SKILL.md +463 -0
- package/.agent/skills/game-development/ai-playtest-framework/SKILL.md +570 -0
- package/.agent/skills/game-development/camera-systems/SKILL.md +607 -0
- package/.agent/skills/game-development/card-battle-engine/SKILL.md +618 -0
- package/.agent/skills/game-development/character-controller-3d/SKILL.md +908 -0
- package/.agent/skills/game-development/cloud-save-sync/SKILL.md +527 -0
- package/.agent/skills/game-development/combat-system/SKILL.md +748 -0
- package/.agent/skills/game-development/compliance-rating/SKILL.md +277 -0
- package/.agent/skills/game-development/crossplatform-build/SKILL.md +386 -0
- package/.agent/skills/game-development/cultivation-progression/SKILL.md +520 -0
- package/.agent/skills/game-development/data-driven-balance/SKILL.md +535 -0
- package/.agent/skills/game-development/game-analytics-integrator/SKILL.md +410 -0
- package/.agent/skills/game-development/game-audio-advanced/SKILL.md +646 -0
- package/.agent/skills/game-development/game-economy-designer/SKILL.md +375 -0
- package/.agent/skills/game-development/game-marketing/SKILL.md +85 -0
- package/.agent/skills/game-development/game-state-manager/SKILL.md +883 -0
- package/.agent/skills/game-development/godot-expert/SKILL.md +462 -0
- package/.agent/skills/game-development/hybrid-game-spec/SKILL.md +220 -0
- package/.agent/skills/game-development/inventory-quest/SKILL.md +747 -0
- package/.agent/skills/game-development/liveops/SKILL.md +308 -0
- package/.agent/skills/game-development/localization/SKILL.md +286 -0
- package/.agent/skills/game-development/mobile-input-patterns/SKILL.md +343 -0
- package/.agent/skills/game-development/monetization-strategy/SKILL.md +94 -0
- package/.agent/skills/game-development/multiplayer-master/SKILL.md +727 -0
- package/.agent/skills/game-development/narrative-branching/SKILL.md +593 -0
- package/.agent/skills/game-development/npc-ai-integration/SKILL.md +110 -0
- package/.agent/skills/game-development/procedural-generation/SKILL.md +168 -0
- package/.agent/skills/game-development/procedural-level-ai/SKILL.md +367 -0
- package/.agent/skills/game-development/prototyping-rapid/SKILL.md +205 -0
- package/.agent/skills/game-development/spec-ecosystem/SKILL.md +155 -0
- package/.agent/skills/game-development/spec-ecosystem/decision-log-format.md +129 -0
- package/.agent/skills/game-development/spec-ecosystem/templates/PLAN-template.md +178 -0
- package/.agent/skills/game-development/spec-ecosystem/templates/SPEC-template.md +110 -0
- package/.agent/skills/game-development/spec-ecosystem/templates/TASKS-template.md +156 -0
- package/.agent/skills/game-development/survival-systems/SKILL.md +493 -0
- package/.agent/skills/game-development/testing-qa/SKILL.md +270 -0
- package/.agent/skills/game-development/unity-integration/SKILL.md +358 -0
- package/.agent/skills/game-development/unity-mobile-optimization/SKILL.md +271 -0
- package/.agent/skills/game-development/webgpu-shading/SKILL.md +209 -0
- package/.agent/skills/gcp-cloud-run/SKILL.md +358 -0
- package/.agent/skills/graphql/SKILL.md +492 -0
- package/.agent/skills/idor-testing/SKILL.md +64 -0
- package/.agent/skills/inngest/SKILL.md +128 -0
- package/.agent/skills/intent-capture/SKILL.md +65 -0
- package/.agent/skills/langfuse/SKILL.md +415 -0
- package/.agent/skills/langgraph/SKILL.md +360 -0
- package/.agent/skills/launch-strategy/SKILL.md +68 -0
- package/.agent/skills/linux-privilege-escalation/SKILL.md +62 -0
- package/.agent/skills/llm-app-patterns/SKILL.md +367 -0
- package/.agent/skills/marketing-ideas/SKILL.md +66 -0
- package/.agent/skills/mcp-composition/SKILL.md +362 -0
- package/.agent/skills/mcp-observability/SKILL.md +323 -0
- package/.agent/skills/mcp-security/SKILL.md +314 -0
- package/.agent/skills/metasploit-framework/SKILL.md +60 -0
- package/.agent/skills/micro-saas-launcher/SKILL.md +93 -0
- package/.agent/skills/neon-postgres/SKILL.md +339 -0
- package/.agent/skills/paid-ads/SKILL.md +64 -0
- package/.agent/skills/supabase-integration/SKILL.md +411 -0
- package/.agent/skills/trust-spectrum/SKILL.md +291 -0
- package/.agent/skills/vibe-coding-guard/SKILL.md +328 -0
- package/.agent/templates/AGENTS.game.md +63 -0
- package/.agent/templates/docs/WORKFLOW_GUIDE.en.md +100 -0
- package/.agent/templates/docs/WORKFLOW_GUIDE.vi.md +100 -0
- package/.agent/workflows/ai-agent.md +38 -0
- package/.agent/workflows/autofix.md +1 -0
- package/.agent/workflows/brainstorm.md +1 -0
- package/.agent/workflows/context.md +1 -0
- package/.agent/workflows/create.md +39 -8
- package/.agent/workflows/dashboard.md +1 -0
- package/.agent/workflows/debug.md +14 -0
- package/.agent/workflows/deploy.md +14 -0
- package/.agent/workflows/enhance.md +44 -0
- package/.agent/workflows/gamekit-init.md +177 -0
- package/.agent/workflows/gamekit-launch.md +338 -0
- package/.agent/workflows/gamekit-plan.md +204 -0
- package/.agent/workflows/gamekit-qa.md +153 -0
- package/.agent/workflows/gamekit-spec.md +243 -0
- package/.agent/workflows/gamekit-tasks.md +208 -0
- package/.agent/workflows/marketing.md +39 -0
- package/.agent/workflows/next.md +1 -0
- package/.agent/workflows/orchestrate.md +12 -0
- package/.agent/workflows/pentest.md +39 -0
- package/.agent/workflows/plan.md +42 -0
- package/.agent/workflows/preview.md +1 -0
- package/.agent/workflows/quality.md +1 -0
- package/.agent/workflows/saas.md +38 -0
- package/.agent/workflows/spec.md +42 -0
- package/.agent/workflows/status.md +1 -0
- package/.agent/workflows/test.md +14 -0
- package/.agent/workflows/ui-ux-pro-max.md +1 -0
- package/README.md +4 -4
- package/bin/cli.js +411 -111
- package/package.json +1 -2
- package/docs/AI_DATA_INFRASTRUCTURE.md +0 -288
- package/docs/CHANGELOG_AI_INFRA.md +0 -111
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: crewai
|
|
3
|
+
description: "CrewAI multi-agent collaboration patterns. Design collaborative AI agent teams with roles, responsibilities, and delegation. Learn to create agent personas, define tasks with expected outputs, and orchestrate crews for optimal collaboration."
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
source: "antigravity-awesome-skills (adapted)"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 🤝 CrewAI
|
|
9
|
+
|
|
10
|
+
**Role**: CrewAI Multi-Agent Architect
|
|
11
|
+
|
|
12
|
+
You are an expert in designing collaborative AI agent teams with CrewAI. You think in terms of roles, responsibilities, and delegation. You design clear agent personas with specific expertise, create well-defined tasks with expected outputs, and orchestrate crews for optimal collaboration.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## When to Use This Skill
|
|
17
|
+
|
|
18
|
+
- Building multi-agent systems with role-based collaboration
|
|
19
|
+
- Tasks requiring diverse expertise (research + writing + review)
|
|
20
|
+
- Hierarchical workflows with manager delegation
|
|
21
|
+
- Sequential task dependencies
|
|
22
|
+
- Need structured output formats
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Capabilities
|
|
27
|
+
|
|
28
|
+
- `crewai`
|
|
29
|
+
- `multi-agent`
|
|
30
|
+
- `role-based-agents`
|
|
31
|
+
- `task-delegation`
|
|
32
|
+
- `hierarchical-process`
|
|
33
|
+
- `sequential-process`
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Requirements
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install crewai crewai-tools
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 1. Core Concepts
|
|
46
|
+
|
|
47
|
+
### CrewAI Architecture
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
51
|
+
│ CREW │
|
|
52
|
+
│ │
|
|
53
|
+
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
|
|
54
|
+
│ │ Agent 1 │ │ Agent 2 │ │ Agent 3 │ │
|
|
55
|
+
│ │Researcher│ │ Writer │ │ Reviewer │ │
|
|
56
|
+
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
|
|
57
|
+
│ │ │ │ │
|
|
58
|
+
│ ▼ ▼ ▼ │
|
|
59
|
+
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
|
|
60
|
+
│ │ Task 1 │───▶│ Task 2 │───▶│ Task 3 │ │
|
|
61
|
+
│ │ Research │ │ Write │ │ Review │ │
|
|
62
|
+
│ └──────────┘ └──────────┘ └──────────┘ │
|
|
63
|
+
│ │
|
|
64
|
+
│ Process: sequential | hierarchical │
|
|
65
|
+
└─────────────────────────────────────────────────────────────┘
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
| Component | Description |
|
|
69
|
+
|-----------|-------------|
|
|
70
|
+
| **Agent** | AI with role, goal, backstory, and tools |
|
|
71
|
+
| **Task** | Work to be done with description and expected output |
|
|
72
|
+
| **Crew** | Collection of agents executing tasks |
|
|
73
|
+
| **Process** | Sequential (one by one) or Hierarchical (manager) |
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 2. Patterns
|
|
78
|
+
|
|
79
|
+
### 2.1 Basic Crew with YAML Config
|
|
80
|
+
|
|
81
|
+
Define agents and tasks in YAML (recommended approach).
|
|
82
|
+
|
|
83
|
+
**config/agents.yaml**
|
|
84
|
+
```yaml
|
|
85
|
+
researcher:
|
|
86
|
+
role: "Senior Research Analyst"
|
|
87
|
+
goal: "Find comprehensive, accurate information on {topic}"
|
|
88
|
+
backstory: |
|
|
89
|
+
You are an expert researcher with years of experience
|
|
90
|
+
in gathering and analyzing information. You're known
|
|
91
|
+
for your thorough and accurate research.
|
|
92
|
+
tools:
|
|
93
|
+
- SerperDevTool
|
|
94
|
+
- WebsiteSearchTool
|
|
95
|
+
verbose: true
|
|
96
|
+
|
|
97
|
+
writer:
|
|
98
|
+
role: "Content Writer"
|
|
99
|
+
goal: "Create engaging, well-structured content"
|
|
100
|
+
backstory: |
|
|
101
|
+
You are a skilled writer who transforms research
|
|
102
|
+
into compelling narratives. You focus on clarity
|
|
103
|
+
and engagement.
|
|
104
|
+
verbose: true
|
|
105
|
+
|
|
106
|
+
reviewer:
|
|
107
|
+
role: "Quality Reviewer"
|
|
108
|
+
goal: "Ensure content is accurate, clear, and polished"
|
|
109
|
+
backstory: |
|
|
110
|
+
You are a meticulous editor who catches errors
|
|
111
|
+
and improves clarity. You never let subpar content
|
|
112
|
+
pass your review.
|
|
113
|
+
verbose: true
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**config/tasks.yaml**
|
|
117
|
+
```yaml
|
|
118
|
+
research_task:
|
|
119
|
+
description: |
|
|
120
|
+
Research the topic: {topic}
|
|
121
|
+
|
|
122
|
+
Focus on:
|
|
123
|
+
1. Key facts and statistics
|
|
124
|
+
2. Recent developments
|
|
125
|
+
3. Expert opinions
|
|
126
|
+
4. Contrarian viewpoints
|
|
127
|
+
|
|
128
|
+
Be thorough and cite sources.
|
|
129
|
+
agent: researcher
|
|
130
|
+
expected_output: |
|
|
131
|
+
A comprehensive research report with:
|
|
132
|
+
- Executive summary
|
|
133
|
+
- Key findings (bulleted)
|
|
134
|
+
- Sources cited
|
|
135
|
+
|
|
136
|
+
writing_task:
|
|
137
|
+
description: |
|
|
138
|
+
Using the research provided, write an article about {topic}.
|
|
139
|
+
|
|
140
|
+
Requirements:
|
|
141
|
+
- 800-1000 words
|
|
142
|
+
- Engaging introduction
|
|
143
|
+
- Clear structure with headers
|
|
144
|
+
- Actionable conclusion
|
|
145
|
+
agent: writer
|
|
146
|
+
expected_output: "A polished article ready for publication"
|
|
147
|
+
context:
|
|
148
|
+
- research_task # Uses output from research
|
|
149
|
+
|
|
150
|
+
review_task:
|
|
151
|
+
description: |
|
|
152
|
+
Review the article for:
|
|
153
|
+
- Factual accuracy
|
|
154
|
+
- Grammar and style
|
|
155
|
+
- Clarity and flow
|
|
156
|
+
- Engagement
|
|
157
|
+
|
|
158
|
+
Provide specific improvement suggestions.
|
|
159
|
+
agent: reviewer
|
|
160
|
+
expected_output: "Reviewed and improved final article"
|
|
161
|
+
context:
|
|
162
|
+
- writing_task
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**crew.py**
|
|
166
|
+
```python
|
|
167
|
+
from crewai import Agent, Task, Crew, Process
|
|
168
|
+
from crewai.project import CrewBase, agent, task, crew
|
|
169
|
+
|
|
170
|
+
@CrewBase
|
|
171
|
+
class ContentCrew:
|
|
172
|
+
agents_config = 'config/agents.yaml'
|
|
173
|
+
tasks_config = 'config/tasks.yaml'
|
|
174
|
+
|
|
175
|
+
@agent
|
|
176
|
+
def researcher(self) -> Agent:
|
|
177
|
+
return Agent(config=self.agents_config['researcher'])
|
|
178
|
+
|
|
179
|
+
@agent
|
|
180
|
+
def writer(self) -> Agent:
|
|
181
|
+
return Agent(config=self.agents_config['writer'])
|
|
182
|
+
|
|
183
|
+
@agent
|
|
184
|
+
def reviewer(self) -> Agent:
|
|
185
|
+
return Agent(config=self.agents_config['reviewer'])
|
|
186
|
+
|
|
187
|
+
@task
|
|
188
|
+
def research_task(self) -> Task:
|
|
189
|
+
return Task(config=self.tasks_config['research_task'])
|
|
190
|
+
|
|
191
|
+
@task
|
|
192
|
+
def writing_task(self) -> Task:
|
|
193
|
+
return Task(config=self.tasks_config['writing_task'])
|
|
194
|
+
|
|
195
|
+
@task
|
|
196
|
+
def review_task(self) -> Task:
|
|
197
|
+
return Task(config=self.tasks_config['review_task'])
|
|
198
|
+
|
|
199
|
+
@crew
|
|
200
|
+
def crew(self) -> Crew:
|
|
201
|
+
return Crew(
|
|
202
|
+
agents=self.agents,
|
|
203
|
+
tasks=self.tasks,
|
|
204
|
+
process=Process.sequential,
|
|
205
|
+
verbose=True
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
# Run
|
|
209
|
+
crew = ContentCrew()
|
|
210
|
+
result = crew.crew().kickoff(inputs={"topic": "AI in Healthcare"})
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### 2.2 Hierarchical Process
|
|
214
|
+
|
|
215
|
+
Manager agent delegates to specialized workers.
|
|
216
|
+
|
|
217
|
+
```python
|
|
218
|
+
from crewai import Agent, Task, Crew, Process
|
|
219
|
+
from langchain_openai import ChatOpenAI
|
|
220
|
+
|
|
221
|
+
# Define specialized agents
|
|
222
|
+
researcher = Agent(
|
|
223
|
+
role="Research Specialist",
|
|
224
|
+
goal="Find accurate information",
|
|
225
|
+
backstory="Expert researcher with 10 years experience",
|
|
226
|
+
verbose=True
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
analyst = Agent(
|
|
230
|
+
role="Data Analyst",
|
|
231
|
+
goal="Analyze and interpret data",
|
|
232
|
+
backstory="Expert analyst who finds insights in data",
|
|
233
|
+
verbose=True
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
writer = Agent(
|
|
237
|
+
role="Content Writer",
|
|
238
|
+
goal="Create engaging content",
|
|
239
|
+
backstory="Award-winning writer with clear style",
|
|
240
|
+
verbose=True
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
# Define tasks
|
|
244
|
+
research_task = Task(
|
|
245
|
+
description="Research {topic} thoroughly",
|
|
246
|
+
expected_output="Comprehensive research findings",
|
|
247
|
+
agent=researcher
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
analysis_task = Task(
|
|
251
|
+
description="Analyze the research findings",
|
|
252
|
+
expected_output="Key insights and patterns",
|
|
253
|
+
agent=analyst
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
writing_task = Task(
|
|
257
|
+
description="Write article based on research and analysis",
|
|
258
|
+
expected_output="Publication-ready article",
|
|
259
|
+
agent=writer
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
# Hierarchical crew - manager coordinates
|
|
263
|
+
crew = Crew(
|
|
264
|
+
agents=[researcher, analyst, writer],
|
|
265
|
+
tasks=[research_task, analysis_task, writing_task],
|
|
266
|
+
process=Process.hierarchical,
|
|
267
|
+
manager_llm=ChatOpenAI(model="gpt-4o"), # Manager model
|
|
268
|
+
verbose=True
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
# Manager decides:
|
|
272
|
+
# - Which agent handles which part
|
|
273
|
+
# - When to delegate
|
|
274
|
+
# - How to combine results
|
|
275
|
+
|
|
276
|
+
result = crew.kickoff(inputs={"topic": "Future of Work"})
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### 2.3 Planning Feature
|
|
280
|
+
|
|
281
|
+
Enable automatic plan generation before execution.
|
|
282
|
+
|
|
283
|
+
```python
|
|
284
|
+
crew = Crew(
|
|
285
|
+
agents=[researcher, writer, reviewer],
|
|
286
|
+
tasks=[research, write, review],
|
|
287
|
+
process=Process.sequential,
|
|
288
|
+
planning=True, # Enable planning
|
|
289
|
+
planning_llm=ChatOpenAI(model="gpt-4o")
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
# With planning enabled:
|
|
293
|
+
# 1. CrewAI generates step-by-step plan
|
|
294
|
+
# 2. Plan is injected into each task
|
|
295
|
+
# 3. Agents see overall structure
|
|
296
|
+
# 4. More consistent results
|
|
297
|
+
|
|
298
|
+
result = crew.kickoff()
|
|
299
|
+
|
|
300
|
+
# Access the plan
|
|
301
|
+
print(crew.plan)
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### 2.4 Custom Tools
|
|
305
|
+
|
|
306
|
+
```python
|
|
307
|
+
from crewai_tools import BaseTool
|
|
308
|
+
|
|
309
|
+
class DatabaseSearchTool(BaseTool):
|
|
310
|
+
name: str = "Database Search"
|
|
311
|
+
description: str = "Search internal database for information"
|
|
312
|
+
|
|
313
|
+
def _run(self, query: str) -> str:
|
|
314
|
+
# Implementation
|
|
315
|
+
results = db.search(query)
|
|
316
|
+
return f"Found {len(results)} results: {results}"
|
|
317
|
+
|
|
318
|
+
# Assign to agent
|
|
319
|
+
researcher = Agent(
|
|
320
|
+
role="Researcher",
|
|
321
|
+
goal="Find information",
|
|
322
|
+
backstory="...",
|
|
323
|
+
tools=[DatabaseSearchTool()]
|
|
324
|
+
)
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### 2.5 Memory & Learning
|
|
328
|
+
|
|
329
|
+
```python
|
|
330
|
+
from crewai import Crew
|
|
331
|
+
|
|
332
|
+
# Enable memory for learning across runs
|
|
333
|
+
crew = Crew(
|
|
334
|
+
agents=[...],
|
|
335
|
+
tasks=[...],
|
|
336
|
+
memory=True, # Enable memory
|
|
337
|
+
embedder={
|
|
338
|
+
"provider": "openai",
|
|
339
|
+
"config": {"model": "text-embedding-3-small"}
|
|
340
|
+
}
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
# First run - learns
|
|
344
|
+
result1 = crew.kickoff(inputs={"topic": "AI"})
|
|
345
|
+
|
|
346
|
+
# Second run - uses learned context
|
|
347
|
+
result2 = crew.kickoff(inputs={"topic": "Machine Learning"})
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## 3. Anti-Patterns
|
|
353
|
+
|
|
354
|
+
### ❌ Vague Agent Roles
|
|
355
|
+
|
|
356
|
+
```python
|
|
357
|
+
# WRONG: Too generic
|
|
358
|
+
agent = Agent(
|
|
359
|
+
role="Helper",
|
|
360
|
+
goal="Help with things",
|
|
361
|
+
backstory="I help"
|
|
362
|
+
)
|
|
363
|
+
|
|
364
|
+
# CORRECT: Specific expertise
|
|
365
|
+
agent = Agent(
|
|
366
|
+
role="Senior Financial Analyst",
|
|
367
|
+
goal="Analyze financial data to identify investment opportunities",
|
|
368
|
+
backstory="""
|
|
369
|
+
You have 15 years of experience at Goldman Sachs analyzing
|
|
370
|
+
market trends. You're known for identifying undervalued stocks
|
|
371
|
+
before they become mainstream picks. You focus on fundamentals
|
|
372
|
+
and long-term value.
|
|
373
|
+
"""
|
|
374
|
+
)
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### ❌ Missing Expected Outputs
|
|
378
|
+
|
|
379
|
+
```python
|
|
380
|
+
# WRONG: No clear output format
|
|
381
|
+
task = Task(
|
|
382
|
+
description="Research AI trends",
|
|
383
|
+
agent=researcher
|
|
384
|
+
)
|
|
385
|
+
|
|
386
|
+
# CORRECT: Specific output format
|
|
387
|
+
task = Task(
|
|
388
|
+
description="Research AI trends in healthcare",
|
|
389
|
+
expected_output="""
|
|
390
|
+
A structured report containing:
|
|
391
|
+
- Executive Summary (3-5 sentences)
|
|
392
|
+
- Top 5 Trends (with evidence)
|
|
393
|
+
- Key Statistics (with sources)
|
|
394
|
+
- Expert Predictions (3+ experts)
|
|
395
|
+
- Potential Risks (bulleted)
|
|
396
|
+
""",
|
|
397
|
+
agent=researcher
|
|
398
|
+
)
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### ❌ Too Many Agents
|
|
402
|
+
|
|
403
|
+
```python
|
|
404
|
+
# WRONG: Agent for every micro-task
|
|
405
|
+
crew = Crew(
|
|
406
|
+
agents=[
|
|
407
|
+
Agent(role="Title Writer"),
|
|
408
|
+
Agent(role="Introduction Writer"),
|
|
409
|
+
Agent(role="Body Writer"),
|
|
410
|
+
Agent(role="Conclusion Writer"),
|
|
411
|
+
Agent(role="Grammar Checker"),
|
|
412
|
+
Agent(role="Style Editor"),
|
|
413
|
+
# ... 10 more agents
|
|
414
|
+
]
|
|
415
|
+
)
|
|
416
|
+
|
|
417
|
+
# CORRECT: Consolidated roles
|
|
418
|
+
crew = Crew(
|
|
419
|
+
agents=[
|
|
420
|
+
Agent(role="Content Strategist"),
|
|
421
|
+
Agent(role="Writer"),
|
|
422
|
+
Agent(role="Editor")
|
|
423
|
+
]
|
|
424
|
+
)
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
---
|
|
428
|
+
|
|
429
|
+
## 4. Best Practices
|
|
430
|
+
|
|
431
|
+
### Agent Design
|
|
432
|
+
| Practice | Description |
|
|
433
|
+
|----------|-------------|
|
|
434
|
+
| **Specific roles** | Each agent has distinct expertise |
|
|
435
|
+
| **Rich backstory** | 3-5 sentences of context |
|
|
436
|
+
| **Focused goal** | One clear objective |
|
|
437
|
+
| **Appropriate tools** | Only tools needed for role |
|
|
438
|
+
|
|
439
|
+
### Task Design
|
|
440
|
+
| Practice | Description |
|
|
441
|
+
|----------|-------------|
|
|
442
|
+
| **Clear description** | Step-by-step what to do |
|
|
443
|
+
| **Expected output** | Exact format expected |
|
|
444
|
+
| **Context** | Reference dependent tasks |
|
|
445
|
+
| **Single responsibility** | One outcome per task |
|
|
446
|
+
|
|
447
|
+
### Crew Composition
|
|
448
|
+
| Crew Size | Use Case |
|
|
449
|
+
|-----------|----------|
|
|
450
|
+
| 2-3 agents | Simple workflows |
|
|
451
|
+
| 4-5 agents | Complex multi-step |
|
|
452
|
+
| 5+ agents | Use hierarchical |
|
|
453
|
+
|
|
454
|
+
---
|
|
455
|
+
|
|
456
|
+
## 5. Process Comparison
|
|
457
|
+
|
|
458
|
+
| Process | Best For | Pros | Cons |
|
|
459
|
+
|---------|----------|------|------|
|
|
460
|
+
| **Sequential** | Linear workflows | Predictable, simple | No parallelism |
|
|
461
|
+
| **Hierarchical** | Complex delegation | Flexible, dynamic | Needs manager LLM |
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
## Related Skills
|
|
466
|
+
|
|
467
|
+
- `langgraph` - Alternative graph-based agents
|
|
468
|
+
- `llm-app-patterns` - LLM architecture patterns
|
|
469
|
+
- `autonomous-agent-patterns` - Agent design patterns
|
|
470
|
+
- `parallel-agents` - Agent orchestration patterns
|