Spaces:
Running
Running
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>CrewAI Learning Platform & Cheatsheet</title> | |
| <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css"> | |
| <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.0/css/all.min.css"> | |
| <style> | |
| body { | |
| font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif; | |
| line-height: 1.6; | |
| color: #333; | |
| } | |
| .section { | |
| padding: 2rem 0; | |
| margin-bottom: 1.5rem; | |
| } | |
| .code-block { | |
| font-family: monospace; | |
| font-size: 0.9rem; | |
| white-space: pre-wrap; | |
| padding: 1rem; | |
| margin: 1rem 0; | |
| background-color: black; | |
| border-radius: 0.5rem; | |
| overflow-x: auto; | |
| } | |
| .reference-table { | |
| width: 100%; | |
| border-collapse: collapse; | |
| margin: 1rem 0; | |
| } | |
| .reference-table th, .reference-table td { | |
| padding: 0.75rem; | |
| text-align: left; | |
| border: 1px solid #e5e7eb; | |
| } | |
| .reference-table th { | |
| background-color: #f9fafb; | |
| font-weight: 600; | |
| } | |
| .reference-table tr:nth-child(even) { | |
| background-color: #f9fafb; | |
| } | |
| .toc-link { | |
| display: block; | |
| padding: 0.5rem 0; | |
| text-decoration: none; | |
| color: #4b5563; | |
| border-left: 2px solid transparent; | |
| padding-left: 0.75rem; | |
| margin-bottom: 0.25rem; | |
| transition: all 0.2s; | |
| } | |
| .toc-link:hover { | |
| color: #3b82f6; | |
| border-left-color: #3b82f6; | |
| background-color: #f3f4f6; | |
| } | |
| .toc-active { | |
| color: #1e40af; | |
| border-left-color: #1e40af; | |
| font-weight: 600; | |
| } | |
| .card { | |
| border: 1px solid #e5e7eb; | |
| border-radius: 0.5rem; | |
| padding: 1rem; | |
| margin-bottom: 1rem; | |
| transition: transform 0.2s, box-shadow 0.2s; | |
| } | |
| .card:hover { | |
| transform: translateY(-2px); | |
| box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); | |
| } | |
| h1, h2, h3, h4 { | |
| font-weight: 700; | |
| } | |
| h1 { | |
| font-size: 2rem; | |
| margin-bottom: 1.5rem; | |
| } | |
| h2 { | |
| font-size: 1.5rem; | |
| margin: 2rem 0 1rem 0; | |
| padding-bottom: 0.5rem; | |
| border-bottom: 2px solid #e5e7eb; | |
| } | |
| h3 { | |
| font-size: 1.25rem; | |
| margin: 1.5rem 0 1rem 0; | |
| } | |
| h4 { | |
| font-size: 1.1rem; | |
| margin: 1.25rem 0 0.75rem 0; | |
| } | |
| .banner { | |
| background: linear-gradient(to right, #3b82f6, #2563eb); | |
| color: white; | |
| padding: 2rem; | |
| border-radius: 0.5rem; | |
| margin-bottom: 2rem; | |
| } | |
| .step { | |
| position: relative; | |
| padding-left: 2.5rem; | |
| margin-bottom: 1.5rem; | |
| } | |
| .step-number { | |
| position: absolute; | |
| left: 0; | |
| top: 0; | |
| width: 2rem; | |
| height: 2rem; | |
| background-color: #3b82f6; | |
| color: white; | |
| border-radius: 50%; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| font-weight: 700; | |
| } | |
| .tip { | |
| background-color: #dbeafe; | |
| border-left: 4px solid #3b82f6; | |
| padding: 1rem; | |
| margin: 1rem 0; | |
| border-radius: 0.25rem; | |
| } | |
| .warning { | |
| background-color: #fef3c7; | |
| border-left: 4px solid #d97706; | |
| padding: 1rem; | |
| margin: 1rem 0; | |
| border-radius: 0.25rem; | |
| } | |
| .success-box { | |
| background-color: #d1fae5; | |
| border-left: 4px solid #10b981; | |
| padding: 1rem; | |
| margin: 1rem 0; | |
| border-radius: 0.25rem; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-black-50"> | |
| <header class="bg-white shadow-md"> | |
| <div class="container mx-auto px-4 py-6"> | |
| <h1 class="text-4xl font-bold text-center text-blue-800">CrewAI Learning Platform & Cheatsheet</h1> | |
| <p class="text-center text-gray-600 mt-2">A comprehensive guide to building multi-agent systems with CrewAI</p> | |
| </div> | |
| </header> | |
| <div class="container mx-auto px-4 py-8"> | |
| <div class="flex flex-col md:flex-row"> | |
| <!-- Table of Contents - Fixed on larger screens --> | |
| <div class="md:w-1/4 md:sticky md:top-0 md:h-screen md:pt-8 md:overflow-y-auto pr-4"> | |
| <div class="bg-white p-4 rounded-lg shadow mb-6"> | |
| <h3 class="text-lg font-semibold mb-4 text-blue-800">Table of Contents</h3> | |
| <nav class="toc"> | |
| <a href="#introduction" class="toc-link">1. Introduction to CrewAI</a> | |
| <a href="#installation" class="toc-link">2. Installation & Setup</a> | |
| <a href="#core-concepts" class="toc-link">3. Core Concepts</a> | |
| <a href="#agents" class="toc-link ml-4">3.1 Agents</a> | |
| <a href="#tasks" class="toc-link ml-4">3.2 Tasks</a> | |
| <a href="#crews" class="toc-link ml-4">3.3 Crews</a> | |
| <a href="#tools" class="toc-link ml-4">3.4 Tools</a> | |
| <a href="#first-crew" class="toc-link">4. Building Your First Crew</a> | |
| <a href="#advanced-features" class="toc-link">5. Advanced Features</a> | |
| <a href="#examples" class="toc-link">6. Example Applications</a> | |
| <a href="#cheatsheet" class="toc-link">7. CrewAI Cheatsheet</a> | |
| <a href="#best-practices" class="toc-link">8. Best Practices</a> | |
| <a href="#resources" class="toc-link">9. Additional Resources</a> | |
| </nav> | |
| </div> | |
| </div> | |
| <!-- Main Content --> | |
| <div class="md:w-3/4"> | |
| <div class="banner rounded-lg"> | |
| <h2 class="text-3xl font-bold mb-4">Master Multi-Agent Systems with CrewAI</h2> | |
| <p class="text-xl">Create powerful, collaborative AI systems that can tackle complex tasks through agent cooperation and specialization</p> | |
| </div> | |
| <!-- Introduction Section --> | |
| <section id="introduction" class="section bg-white p-6 rounded-lg shadow"> | |
| <h2 class="text-2xl font-bold text-blue-800">1. Introduction to CrewAI</h2> | |
| <h3 class="text-xl font-semibold mt-6">What is CrewAI?</h3> | |
| <p class="mt-3"> | |
| CrewAI is a cutting-edge Python framework designed for orchestrating role-playing, autonomous AI agents. It enables the creation of specialized AI teams where agents can take on different roles, make autonomous decisions, and collaborate to solve complex problems. Unlike single-agent systems, CrewAI focuses on collaborative intelligence, allowing for more sophisticated problem-solving through agent specialization and teamwork. | |
| </p> | |
| <h3 class="text-xl font-semibold mt-6">Why Use CrewAI?</h3> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-3"> | |
| <div class="card"> | |
| <h4 class="font-semibold text-blue-700"><i class="fas fa-users mr-2"></i>Role-Playing Agents</h4> | |
| <p>Agents can assume specific personas with unique goals, backstories, and expertise areas, enabling more specialized task performance.</p> | |
| </div> | |
| <div class="card"> | |
| <h4 class="font-semibold text-blue-700"><i class="fas fa-robot mr-2"></i>Autonomous Decision Making</h4> | |
| <p>Agents can make decisions independently based on their goals and available information, reducing the need for human intervention.</p> | |
| </div> | |
| <div class="card"> | |
| <h4 class="font-semibold text-blue-700"><i class="fas fa-comments mr-2"></i>Seamless Collaboration</h4> | |
| <p>Agents can work together, sharing information and building upon each other's outputs to tackle complex, multi-stage tasks.</p> | |
| </div> | |
| <div class="card"> | |
| <h4 class="font-semibold text-blue-700"><i class="fas fa-puzzle-piece mr-2"></i>Complex Problem Solving</h4> | |
| <p>The framework is designed to handle intricate workflows, decision trees, and multi-stage problems that would be challenging for single agents.</p> | |
| </div> | |
| </div> | |
| <h3 class="text-xl font-semibold mt-6">Key Features of CrewAI</h3> | |
| <ul class="list-disc pl-6 mt-3"> | |
| <li class="mb-2"><span class="font-semibold">Independent Framework:</span> Built from scratch without dependencies on other agent frameworks like LangChain.</li> | |
| <li class="mb-2"><span class="font-semibold">Flexible Agent Design:</span> Create agents with customized roles, goals, tools, and personalities.</li> | |
| <li class="mb-2"><span class="font-semibold">Process Flexibility:</span> Choose between sequential and hierarchical process flows for task execution.</li> | |
| <li class="mb-2"><span class="font-semibold">Tool Integration:</span> Integrate a wide range of tools to enhance agent capabilities for specific tasks.</li> | |
| <li class="mb-2"><span class="font-semibold">Memory Systems:</span> Incorporate short-term and long-term memory to enhance agent performance over time.</li> | |
| <li class="mb-2"><span class="font-semibold">Output Formatting:</span> Structured outputs in various formats including raw text, JSON, and Pydantic models.</li> | |
| </ul> | |
| </section> | |
| <!-- Installation Section --> | |
| <section id="installation" class="section bg-white p-6 rounded-lg shadow"> | |
| <h2 class="text-2xl font-bold text-blue-800">2. Installation & Setup</h2> | |
| <h3 class="text-xl font-semibold mt-4">Installing CrewAI</h3> | |
| <p class="mt-2">Install CrewAI using pip:</p> | |
| <div class="code-block bg-black-800 text-white">pip install crewai</div> | |
| <p class="mt-3">For additional tools support:</p> | |
| <div class="code-block bg-black-800 text-white">pip install crewai-tools</div> | |
| <h3 class="text-xl font-semibold mt-6">Environment Setup</h3> | |
| <p class="mt-2">CrewAI works with various language models. For OpenAI models, set up your API key:</p> | |
| <div class="code-block bg-black-800 text-white"># In your .env file | |
| OPENAI_API_KEY=your-api-key-here</div> | |
| <p class="mt-3">For local models using Ollama:</p> | |
| <div class="code-block bg-black-800 text-white"># Example setup for Ollama | |
| from langchain.llms import Ollama | |
| local_llm = Ollama(model="llama2")</div> | |
| <h3 class="text-xl font-semibold mt-6">Project Creation</h3> | |
| <p class="mt-2">Use CrewAI's CLI to create a new project:</p> | |
| <div class="code-block bg-black-800 text-white">pip install crewai-cli | |
| crewai create my_crew_project</div> | |
| <p class="mt-3">This creates a project structure with the following elements:</p> | |
| <div class="code-block bg-black-800 text-white">my_crew_project/ | |
| ├── src/ | |
| │ └── my_crew_project/ | |
| │ ├── config/ | |
| │ │ ├── agents.yaml | |
| │ │ └── tasks.yaml | |
| │ ├── crew.py | |
| │ └── main.py | |
| ├── pyproject.toml | |
| └── README.md</div> | |
| <div class="tip mt-4"> | |
| <strong>Tip:</strong> Use virtual environments to manage your dependencies and avoid conflicts with other projects. Consider using tools like <code>venv</code>, <code>virtualenv</code>, or <code>conda</code>. | |
| </div> | |
| </section> | |
| <!-- Core Concepts Section --> | |
| <section id="core-concepts" class="section bg-white p-6 rounded-lg shadow"> | |
| <h2 class="text-2xl font-bold text-blue-800">3. Core Concepts</h2> | |
| <p class="mt-3"> | |
| CrewAI is built around four main concepts: Agents, Tasks, Crews, and Tools. Understanding these components and how they interact is essential for building effective multi-agent systems. | |
| </p> | |
| </section> | |
| <!-- Agents Section --> | |
| <section id="agents" class="section bg-white p-6 rounded-lg shadow"> | |
| <h3 class="text-xl font-bold text-blue-800">3.1 Agents</h3> | |
| <p class="mt-3"> | |
| An agent in CrewAI is an autonomous unit programmed to perform tasks, make decisions, and communicate with other agents. Each agent has a specific role, goal, and backstory that shape its behavior and decision-making process. | |
| </p> | |
| <h4 class="text-lg font-semibold mt-4">Key Agent Attributes</h4> | |
| <div class="overflow-x-auto"> | |
| <table class="reference-table"> | |
| <thead> | |
| <tr> | |
| <th>Attribute</th> | |
| <th>Description</th> | |
| <th>Required</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr> | |
| <td><code>role</code></td> | |
| <td>Defines the agent's function within the crew</td> | |
| <td>Yes</td> | |
| </tr> | |
| <tr> | |
| <td><code>goal</code></td> | |
| <td>The individual objective that the agent aims to achieve</td> | |
| <td>Yes</td> | |
| </tr> | |
| <tr> | |
| <td><code>backstory</code></td> | |
| <td>Provides context to the agent's role and goal</td> | |
| <td>Yes</td> | |
| </tr> | |
| <tr> | |
| <td><code>llm</code></td> | |
| <td>The language model that powers the agent</td> | |
| <td>No</td> | |
| </tr> | |
| <tr> | |
| <td><code>tools</code></td> | |
| <td>Functions/capabilities the agent can use</td> | |
| <td>No</td> | |
| </tr> | |
| <tr> | |
| <td><code>verbose</code></td> | |
| <td>Controls the level of logging detail</td> | |
| <td>No</td> | |
| </tr> | |
| <tr> | |
| <td><code>allow_delegation</code></td> | |
| <td>Enables the agent to delegate tasks to others</td> | |
| <td>No</td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| </div> | |
| <h4 class="text-lg font-semibold mt-6">Creating an Agent</h4> | |
| <div class="code-block bg-black-800 text-white">from crewai import Agent | |
| researcher = Agent( | |
| role="Research Analyst", | |
| goal="Find the most accurate and up-to-date information on AI trends", | |
| backstory="You're a senior research analyst with 15 years of experience in technology trends analysis. Your attention to detail and ability to distinguish relevant information from noise is unmatched.", | |
| tools=[search_tool], # Optional | |
| llm=openai_llm, # Optional | |
| verbose=True # Optional | |
| )</div> | |
| <h4 class="text-lg font-semibold mt-6">YAML Configuration (Recommended Approach)</h4> | |
| <p class="mt-2">Define agents in YAML for better organization:</p> | |
| <div class="code-block bg-black-800 text-white"># In agents.yaml | |
| researcher: | |
| role: "Research Analyst" | |
| goal: "Find the most accurate and up-to-date information on AI trends" | |
| backstory: "You're a senior research analyst with 15 years of experience in technology trends analysis. Your attention to detail and ability to distinguish relevant information from noise is unmatched." | |
| llm: "openai" # Reference to a defined LLM | |
| writer: | |
| role: "Technical Writer" | |
| goal: "Transform complex research into clear, engaging content" | |
| backstory: "You're an experienced technical writer who can explain complex concepts in simple terms." | |
| llm: "anthropic" # Reference to a defined LLM</div> | |
| <p class="mt-3">Then in your code:</p> | |
| <div class="code-block bg-black-800 text-white">@agent | |
| def researcher(self) -> Agent: | |
| return Agent( | |
| config=self.agents_config["researcher"], | |
| tools=[search_tool] | |
| )</div> | |
| <div class="tip mt-4"> | |
| <p><strong>Best Practices for Agents:</strong></p> | |
| <ul class="list-disc pl-5 mt-2"> | |
| <li>Give agents clear, specific goals that guide their actions</li> | |
| <li>Create detailed backstories that provide context for decision-making</li> | |
| <li>Define specialized roles with minimal overlap to improve collaboration</li> | |
| <li>Equip agents with appropriate tools for their specific roles</li> | |
| </ul> | |
| </div> | |
| </section> | |
| <!-- Tasks Section --> | |
| <section id="tasks" class="section bg-white p-6 rounded-lg shadow"> | |
| <h3 class="text-xl font-bold text-blue-800">3.2 Tasks</h3> | |
| <p class="mt-3"> | |
| Tasks are specific assignments completed by agents. They define what needs to be done, how it should be accomplished, and what the expected output is. Tasks can be assigned to specific agents and can depend on the outputs of other tasks. | |
| </p> | |
| <h4 class="text-lg font-semibold mt-4">Key Task Attributes</h4> | |
| <div class="overflow-x-auto"> | |
| <table class="reference-table"> | |
| <thead> | |
| <tr> | |
| <th>Attribute</th> | |
| <th>Description</th> | |
| <th>Required</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr> | |
| <td><code>description</code></td> | |
| <td>Detailed instructions for the task</td> | |
| <td>Yes</td> | |
| </tr> | |
| <tr> | |
| <td><code>expected_output</code></td> | |
| <td>Description of what the completed task should produce</td> | |
| <td>Yes</td> | |
| </tr> | |
| <tr> | |
| <td><code>agent</code></td> | |
| <td>The agent responsible for executing the task</td> | |
| <td>No*</td> | |
| </tr> | |
| <tr> | |
| <td><code>tools</code></td> | |
| <td>Specific tools available for this task</td> | |
| <td>No</td> | |
| </tr> | |
| <tr> | |
| <td><code>context</code></td> | |
| <td>Outputs from previous tasks to use as context</td> | |
| <td>No</td> | |
| </tr> | |
| <tr> | |
| <td><code>async_execution</code></td> | |
| <td>Whether to execute the task asynchronously</td> | |
| <td>No</td> | |
| </tr> | |
| <tr> | |
| <td><code>human_input</code></td> | |
| <td>Whether human review is required for final answer</td> | |
| <td>No</td> | |
| </tr> | |
| <tr> | |
| <td><code>output_file</code></td> | |
| <td>File path for storing the task output</td> | |
| <td>No</td> | |
| </tr> | |
| <tr> | |
| <td><code>output_json</code></td> | |
| <td>Pydantic model for JSON output structure</td> | |
| <td>No</td> | |
| </tr> | |
| <tr> | |
| <td><code>output_pydantic</code></td> | |
| <td>Pydantic model for output validation</td> | |
| <td>No</td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| </div> | |
| <p class="text-sm mt-1">* Either agent must be specified when creating the task, or assigned when adding the task to a crew.</p> | |
| <h4 class="text-lg font-semibold mt-6">Creating a Task</h4> | |
| <div class="code-block bg-black-800 text-white">from crewai import Task | |
| research_task = Task( | |
| description="Research the latest advancements in quantum computing and their potential applications in cryptography. Focus on breakthroughs from the past 12 months.", | |
| expected_output="A comprehensive 2-page report detailing recent quantum computing advances and their implications for cryptographic systems.", | |
| agent=researcher, | |
| tools=[search_tool, browse_tool], # Optional | |
| context=[], # Optional | |
| async_execution=False # Optional | |
| )</div> | |
| <h4 class="text-lg font-semibold mt-6">YAML Configuration</h4> | |
| <div class="code-block bg-black-800 text-white"># In tasks.yaml | |
| research_task: | |
| description: "Research the latest advancements in quantum computing and their potential applications in cryptography. Focus on breakthroughs from the past 12 months." | |
| expected_output: "A comprehensive 2-page report detailing recent quantum computing advances and their implications for cryptographic systems." | |
| agent: researcher # Reference to agent defined in agents.yaml | |
| write_article_task: | |
| description: "Create an engaging blog article about quantum computing advances aimed at a technical audience with some knowledge of cryptography." | |
| expected_output: "A 1500-word blog article with sections, subheadings, and easily digestible explanations of complex concepts." | |
| agent: writer | |
| context: | |
| - research_task # Reference to another task whose output will be used</div> | |
| <h4 class="text-lg font-semibold mt-6">Task Dependencies & Context</h4> | |
| <p class="mt-2">One of CrewAI's powerful features is the ability to create task dependencies:</p> | |
| <div class="code-block bg-black-800 text-white">from crewai import Task | |
| research_task = Task( | |
| description="Research quantum computing advances", | |
| expected_output="Research report", | |
| agent=researcher | |
| ) | |
| write_article_task = Task( | |
| description="Write an engaging article based on the research findings", | |
| expected_output="1500-word article", | |
| agent=writer, | |
| context=[research_task] # This task depends on research_task | |
| )</div> | |
| <h4 class="text-lg font-semibold mt-6">Structured Output</h4> | |
| <p class="mt-2">For more controlled outputs, use Pydantic models:</p> | |
| <div class="code-block bg-black-800 text-white">from pydantic import BaseModel | |
| from crewai import Task | |
| class ResearchReport(BaseModel): | |
| title: str | |
| summary: str | |
| findings: list[str] | |
| implications: list[str] | |
| research_task = Task( | |
| description="Research quantum computing advances", | |
| expected_output="Structured research report", | |
| agent=researcher, | |
| output_pydantic=ResearchReport # Output will conform to this model | |
| )</div> | |
| <div class="tip mt-4"> | |
| <p><strong>Best Practices for Tasks:</strong></p> | |
| <ul class="list-disc pl-5 mt-2"> | |
| <li>Write clear, specific task descriptions with unambiguous instructions</li> | |
| <li>Define concrete expected outputs that can be measured</li> | |
| <li>Use task context to create logical workflows between agents</li> | |
| <li>Consider using structured outputs for complex data</li> | |
| <li>Break complex processes into multiple distinct tasks</li> | |
| </ul> | |
| </div> | |
| </section> | |
| <!-- Crews Section --> | |
| <section id="crews" class="section bg-white p-6 rounded-lg shadow"> | |
| <h3 class="text-xl font-bold text-blue-800">3.3 Crews</h3> | |
| <p class="mt-3"> | |
| A Crew in CrewAI orchestrates the collaboration between agents to complete a set of tasks. It defines the strategy for task execution, manages the communication between agents, and handles the workflow from start to finish. | |
| </p> | |
| <h4 class="text-lg font-semibold mt-4">Key Crew Attributes</h4> | |
| <div class="overflow-x-auto"> | |
| <table class="reference-table"> | |
| <thead> | |
| <tr> | |
| <th>Attribute</th> | |
| <th>Description</th> | |
| <th>Required</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr> | |
| <td><code>agents</code></td> | |
| <td>List of agents participating in the crew</td> | |
| <td>Yes</td> | |
| </tr> | |
| <tr> | |
| <td><code>tasks</code></td> | |
| <td>List of tasks to be completed by the crew</td> | |
| <td>Yes</td> | |
| </tr> | |
| <tr> | |
| <td><code>process</code></td> | |
| <td>Workflow strategy (sequential/hierarchical)</td> | |
| <td>No</td> | |
| </tr> | |
| <tr> | |
| <td><code>verbose</code></td> | |
| <td>Controls level of logging and output</td> | |
| <td>No</td> | |
| </tr> | |
| <tr> | |
| <td><code>manager_llm</code></td> | |
| <td>LLM used by the manager in hierarchical process</td> | |
| <td>No*</td> | |
| </tr> | |
| <tr> | |
| <td><code>function_calling_llm</code></td> | |
| <td>LLM used for function/tool calling</td> | |
| <td>No</td> | |
| </tr> | |
| <tr> | |
| <td><code>memory</code></td> | |
| <td>Enables storing execution memories</td> | |
| <td>No</td> | |
| </tr> | |
| <tr> | |
| <td><code>cache</code></td> | |
| <td>Enables caching tool execution results</td> | |
| <td>No</td> | |
| </tr> | |
| <tr> | |
| <td><code>full_output</code></td> | |
| <td>Return outputs from all tasks, not just the last</td> | |
| <td>No</td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| </div> | |
| <p class="text-sm mt-1">* Required when using hierarchical process</p> | |
| <h4 class="text-lg font-semibold mt-6">Creating a Crew</h4> | |
| <div class="code-block bg-black-800 text-white">from crewai import Crew | |
| crew = Crew( | |
| agents=[researcher, writer, editor], | |
| tasks=[research_task, writing_task, editing_task], | |
| process="sequential", # Optional, default is sequential | |
| verbose=True, # Optional | |
| memory=True, # Optional | |
| cache=True # Optional | |
| )</div> | |
| <h4 class="text-lg font-semibold mt-6">Process Types</h4> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-3"> | |
| <div class="card"> | |
| <h4 class="font-semibold text-blue-700">Sequential Process</h4> | |
| <p>Tasks are executed one after another in the order they are defined. This is the default process type.</p> | |
| <div class="mt-2"> | |
| <span class="inline-block bg-black-200 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2">Simple to understand</span> | |
| <span class="inline-block bg-black-200 rounded-full px-3 py-1 text-sm font-semibold text-gray-700">Predictable flow</span> | |
| </div> | |
| </div> | |
| <div class="card"> | |
| <h4 class="font-semibold text-blue-700">Hierarchical Process</h4> | |
| <p>A manager agent coordinates the crew, delegating tasks and validating outcomes. Requires a manager_llm.</p> | |
| <div class="mt-2"> | |
| <span class="inline-block bg-black-200 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2">More flexible</span> | |
| <span class="inline-block bg-black-200 rounded-full px-3 py-1 text-sm font-semibold text-gray-700">Complex interactions</span> | |
| </div> | |
| </div> | |
| </div> | |
| <h4 class="text-lg font-semibold mt-6">Kicking Off a Crew</h4> | |
| <div class="code-block bg-black-800 text-white">result = crew.kickoff() | |
| print(result) # Prints the final output | |
| # For hierarchical process | |
| hierarchical_crew = Crew( | |
| agents=[manager, researcher, writer, editor], | |
| tasks=[research_task, writing_task, editing_task], | |
| process="hierarchical", | |
| manager_llm=openai_llm # Required for hierarchical process | |
| ) | |
| result = hierarchical_crew.kickoff()</div> | |
| <h4 class="text-lg font-semibold mt-6">Working with Crew Outputs</h4> | |
| <div class="code-block bg-black-800 text-white">result = crew.kickoff() | |
| # Access the raw text output | |
| print(result.raw) | |
| # If using output_json or output_pydantic in the final task | |
| if result.json_dict: | |
| print(f"Title: {result.json_dict['title']}") | |
| print(f"Summary: {result.json_dict['summary']}") | |
| # Access all task outputs (if full_output=True) | |
| for task_output in result.tasks_output: | |
| print(f"Task: {task_output.description}") | |
| print(f"Output: {task_output.raw}") | |
| # Check token usage | |
| print(f"Token usage: {result.token_usage}")</div> | |
| <div class="tip mt-4"> | |
| <p><strong>Best Practices for Crews:</strong></p> | |
| <ul class="list-disc pl-5 mt-2"> | |
| <li>Start with sequential processes for simpler workflows</li> | |
| <li>Use hierarchical processes when tasks require complex coordination</li> | |
| <li>Enable memory for tasks that benefit from context retention</li> | |
| <li>Use verbose mode during development for debugging</li> | |
| <li>Consider the crew as a reusable workflow that can be applied to different inputs</li> | |
| </ul> | |
| </div> | |
| </section> | |
| <!-- Tools Section --> | |
| <section id="tools" class="section bg-white p-6 rounded-lg shadow"> | |
| <h3 class="text-xl font-bold text-blue-800">3.4 Tools</h3> | |
| <p class="mt-3"> | |
| Tools extend the capabilities of agents, allowing them to perform actions like searching the web, analyzing data, or interacting with external systems. CrewAI supports a wide range of tools from both its own toolkit and LangChain. | |
| </p> | |
| <h4 class="text-lg font-semibold mt-4">Popular CrewAI Tools</h4> | |
| <div class="overflow-x-auto"> | |
| <table class="reference-table"> | |
| <thead> | |
| <tr> | |
| <th>Tool Category</th> | |
| <th>Examples</th> | |
| <th>Use Cases</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr> | |
| <td>Search Tools</td> | |
| <td>SerperDevTool, WebsiteSearchTool</td> | |
| <td>Information gathering, research</td> | |
| </tr> | |
| <tr> | |
| <td>Document Tools</td> | |
| <td>PDFSearchTool, CSVSearchTool, DOCXSearchTool</td> | |
| <td>Extracting information from documents</td> | |
| </tr> | |
| <tr> | |
| <td>Web Tools</td> | |
| <td>ScrapeWebsiteTool, FirecrawlSearchTool</td> | |
| <td>Extracting data from websites</td> | |
| </tr> | |
| <tr> | |
| <td>Code & Data Tools</td> | |
| <td>CodeInterpreterTool, CodeDocsSearchTool</td> | |
| <td>Processing code, analyzing data</td> | |
| </tr> | |
| <tr> | |
| <td>Media Tools</td> | |
| <td>DALL-E Tool, Vision Tool, YoutubeVideoSearchTool</td> | |
| <td>Generating and analyzing media</td> | |
| </tr> | |
| <tr> | |
| <td>RAG Tools</td> | |
| <td>RagTool, Various document search tools</td> | |
| <td>Retrieval augmented generation</td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| </div> | |
| <h4 class="text-lg font-semibold mt-6">Installing Tools</h4> | |
| <div class="code-block bg-black-800 text-white">pip install crewai-tools</div> | |
| <h4 class="text-lg font-semibold mt-6">Using Tools</h4> | |
| <div class="code-block bg-black-800 text-white">from crewai_tools import SerperDevTool, ScrapeWebsiteTool | |
| # Initialize tools | |
| search_tool = SerperDevTool() | |
| scrape_tool = ScrapeWebsiteTool() | |
| # Assign tools to an agent | |
| researcher = Agent( | |
| role="Research Analyst", | |
| goal="Find accurate information", | |
| backstory="You're an expert researcher", | |
| tools=[search_tool, scrape_tool] | |
| )</div> | |
| <h4 class="text-lg font-semibold mt-6">Creating Custom Tools</h4> | |
| <p class="mt-2">There are two main ways to create custom tools in CrewAI:</p> | |
| <h5 class="font-semibold mt-4">1. Using the tool decorator</h5> | |
| <div class="code-block bg-black-800 text-white">from crewai.tools import tool | |
| @tool | |
| def calculate_mortgage(principal: float, interest_rate: float, years: int) -> str: | |
| """ | |
| Calculate the monthly mortgage payment. | |
| Args: | |
| principal: Loan amount in dollars | |
| interest_rate: Annual interest rate (as a decimal, e.g., 0.05 for 5%) | |
| years: Loan term in years | |
| Returns: | |
| Monthly payment amount and total interest paid | |
| """ | |
| # Tool implementation here | |
| monthly_rate = interest_rate / 12 | |
| num_payments = years * 12 | |
| # Calculate monthly payment using the mortgage formula | |
| payment = principal * (monthly_rate * (1 + monthly_rate)**num_payments) / ((1 + monthly_rate)**num_payments - 1) | |
| total_paid = payment * num_payments | |
| total_interest = total_paid - principal | |
| return f"Monthly payment: ${payment:.2f}\nTotal interest paid: ${total_interest:.2f}"</div> | |
| <h5 class="font-semibold mt-4">2. Subclassing BaseTool</h5> | |
| <div class="code-block bg-black-800 text-white">from crewai.tools import BaseTool | |
| from pydantic import Field | |
| from typing import Dict, Any | |
| class StockPriceTool(BaseTool): | |
| """Tool for getting stock price information.""" | |
| name: str = "Stock Price Tool" | |
| description: str = "Get current stock price information for a given ticker symbol" | |
| def _run(self, ticker: str) -> Dict[str, Any]: | |
| """ | |
| Get stock price information. | |
| Args: | |
| ticker: The stock ticker symbol (e.g., AAPL for Apple) | |
| Returns: | |
| Dictionary with stock information | |
| """ | |
| # Implement API call or data retrieval here | |
| # This is a simplified example | |
| import random | |
| price = round(random.uniform(50, 500), 2) | |
| return { | |
| "ticker": ticker, | |
| "price": price, | |
| "currency": "USD", | |
| "timestamp": "2023-10-24T15:30:00Z" | |
| }</div> | |
| <h4 class="text-lg font-semibold mt-6">Tool Caching</h4> | |
| <p class="mt-2">CrewAI tools support caching to improve performance:</p> | |
| <div class="code-block bg-black-800 text-white">from crewai import Agent | |
| # Enable caching at the agent level | |
| researcher = Agent( | |
| role="Research Analyst", | |
| goal="Find accurate information", | |
| backstory="You're an expert researcher", | |
| tools=[search_tool, scrape_tool], | |
| cache=True # Enable caching for all tools used by this agent | |
| )</div> | |
| <div class="warning mt-4"> | |
| <p><strong>Important:</strong> When using tools that require API keys (like SerperDevTool), make sure to set up the appropriate environment variables before using them.</p> | |
| </div> | |
| </section> | |
| <!-- First Crew Section --> | |
| <section id="first-crew" class="section bg-white p-6 rounded-lg shadow"> | |
| <h2 class="text-2xl font-bold text-blue-800">4. Building Your First Crew</h2> | |
| <p class="mt-3"> | |
| Let's walk through building a basic research crew that will research a topic and create a report. This example demonstrates the key concepts of CrewAI in a practical application. | |
| </p> | |
| <h3 class="text-xl font-semibold mt-4">Step 1: Project Setup</h3> | |
| <div class="step"> | |
| <div class="step-number">1</div> | |
| <p>Create a new project directory and set up your environment:</p> | |
| <div class="code-block bg-black-800 text-white">mkdir research-crew | |
| cd research-crew | |
| python -m venv venv | |
| source venv/bin/activate # On Windows: venv\Scripts\activate | |
| pip install crewai crewai-tools</div> | |
| </div> | |
| <h3 class="text-xl font-semibold mt-4">Step 2: Define Your Agents</h3> | |
| <div class="step"> | |
| <div class="step-number">2</div> | |
| <p>Create a file named <code>agents.py</code> to define your agents:</p> | |
| <div class="code-block bg-black-800 text-white">from crewai import Agent | |
| def create_researcher(llm): | |
| return Agent( | |
| role="Research Analyst", | |
| goal="Find comprehensive and accurate information on the given topic", | |
| backstory="You are an experienced research analyst with a talent for finding reliable information quickly. You're meticulous about fact-checking and always seek multiple sources to confirm information.", | |
| llm=llm, | |
| verbose=True | |
| ) | |
| def create_writer(llm): | |
| return Agent( | |
| role="Content Writer", | |
| goal="Transform research findings into clear, engaging, and well-structured reports", | |
| backstory="You are a talented writer with a knack for explaining complex topics in an accessible way. You have experience creating various types of content including reports, articles, and presentations.", | |
| llm=llm, | |
| verbose=True | |
| )</div> | |
| </div> | |
| <h3 class="text-xl font-semibold mt-4">Step 3: Define Your Tasks</h3> | |
| <div class="step"> | |
| <div class="step-number">3</div> | |
| <p>Create a file named <code>tasks.py</code> to define your tasks:</p> | |
| <div class="code-block bg-black-800 text-white">from crewai import Task | |
| from crewai_tools import SerperDevTool | |
| search_tool = SerperDevTool() | |
| def create_research_task(researcher, topic): | |
| return Task( | |
| description=f"Research the topic: {topic}. Find key information including recent developments, major concepts, important figures, and relevant statistics. Focus on high-quality sources and make sure to fact-check the information.", | |
| expected_output="A comprehensive research document with organized sections covering different aspects of the topic. Include a list of sources.", | |
| agent=researcher, | |
| tools=[search_tool] | |
| ) | |
| def create_report_task(writer, topic): | |
| return Task( | |
| description=f"Create a well-structured report on {topic} based on the research findings. The report should be informative, engaging, and easy to understand.", | |
| expected_output="A polished report with an executive summary, introduction, main body (with sections and subsections), conclusion, and references.", | |
| agent=writer | |
| )</div> | |
| </div> | |
| <h3 class="text-xl font-semibold mt-4">Step 4: Set Up Your Crew</h3> | |
| <div class="step"> | |
| <div class="step-number">4</div> | |
| <p>Create a file named <code>crew.py</code> to set up your crew:</p> | |
| <div class="code-block bg-black-800 text-white">from crewai import Crew | |
| from agents import create_researcher, create_writer | |
| from tasks import create_research_task, create_report_task | |
| def create_research_crew(llm, topic): | |
| # Create agents | |
| researcher = create_researcher(llm) | |
| writer = create_writer(llm) | |
| # Create tasks | |
| research_task = create_research_task(researcher, topic) | |
| report_task = create_report_task(writer, topic) | |
| report_task.context = [research_task] # Link tasks | |
| # Create and return the crew | |
| crew = Crew( | |
| agents=[researcher, writer], | |
| tasks=[research_task, report_task], | |
| verbose=True | |
| ) | |
| return crew</div> | |
| </div> | |
| <h3 class="text-xl font-semibold mt-4">Step 5: Create the Main Script</h3> | |
| <div class="step"> | |
| <div class="step-number">5</div> | |
| <p>Create a file named <code>main.py</code> to run your crew:</p> | |
| <div class="code-block bg-black-800 text-white">import os | |
| from dotenv import load_dotenv | |
| from langchain_openai import ChatOpenAI | |
| from crew import create_research_crew | |
| def main(): | |
| # Load environment variables | |
| load_dotenv() | |
| # Set up the language model | |
| llm = ChatOpenAI( | |
| api_key=os.getenv("OPENAI_API_KEY"), | |
| model="gpt-4", | |
| temperature=0.5 | |
| ) | |
| # Topic to research | |
| topic = "Quantum Computing Basics" | |
| # Create and run the crew | |
| crew = create_research_crew(llm, topic) | |
| result = crew.kickoff() | |
| # Save the output to a file | |
| with open("report.md", "w") as f: | |
| f.write(result.raw) | |
| print(f"Research report saved to report.md") | |
| if __name__ == "__main__": | |
| main()</div> | |
| </div> | |
| <h3 class="text-xl font-semibold mt-4">Step 6: Set Up Environment Variables</h3> | |
| <div class="step"> | |
| <div class="step-number">6</div> | |
| <p>Create a <code>.env</code> file with your API keys:</p> | |
| <div class="code-block bg-black-800 text-white">OPENAI_API_KEY=your_openai_api_key_here | |
| SERPER_API_KEY=your_serper_api_key_here</div> | |
| </div> | |
| <h3 class="text-xl font-semibold mt-4">Step 7: Run Your Crew</h3> | |
| <div class="step"> | |
| <div class="step-number">7</div> | |
| <p>Run the main script to execute your crew:</p> | |
| <div class="code-block bg-black-800 text-white">python main.py</div> | |
| <p class="mt-2">You'll see the agents working, thinking, and communicating in the terminal output. When complete, check the generated report.md file for the final output.</p> | |
| </div> | |
| <div class="success-box mt-6"> | |
| <p class="font-semibold">Success!</p> | |
| <p>You've created your first CrewAI crew with:</p> | |
| <ul class="list-disc pl-5 mt-2"> | |
| <li>Two specialized agents with distinct roles</li> | |
| <li>A sequential workflow where tasks build on each other</li> | |
| <li>Integration of external tools for research</li> | |
| <li>A complete end-to-end process from research to report generation</li> | |
| </ul> | |
| </div> | |
| </section> | |
| <!-- Advanced Features Section --> | |
| <section id="advanced-features" class="section bg-white p-6 rounded-lg shadow"> | |
| <h2 class="text-2xl font-bold text-blue-800">5. Advanced Features</h2> | |
| <p class="mt-3"> | |
| CrewAI offers several advanced features that can enhance your multi-agent systems. Let's explore some of these powerful capabilities. | |
| </p> | |
| <h3 class="text-xl font-semibold mt-4">Hierarchical Process</h3> | |
| <p class="mt-2"> | |
| The hierarchical process introduces a manager agent that coordinates the crew's activities, making decisions about task delegation and validation. | |
| </p> | |
| <div class="code-block bg-black-800 text-white">from crewai import Crew | |
| from langchain_openai import ChatOpenAI | |
| manager_llm = ChatOpenAI(model="gpt-4") | |
| crew = Crew( | |
| agents=[researcher, writer, editor], | |
| tasks=[research_task, writing_task, editing_task], | |
| process="hierarchical", | |
| manager_llm=manager_llm, # Required for hierarchical process | |
| verbose=True | |
| ) | |
| result = crew.kickoff()</div> | |
| <h3 class="text-xl font-semibold mt-6">Custom Manager Agent</h3> | |
| <p class="mt-2"> | |
| You can define a custom manager agent with specialized expertise for better coordination: | |
| </p> | |
| <div class="code-block bg-black-800 text-white">from crewai import Agent, Crew | |
| project_manager = Agent( | |
| role="Project Manager", | |
| goal="Efficiently coordinate the team to deliver high-quality outputs on time", | |
| backstory="You're an experienced project manager with a track record of successful project deliveries. You excel at resource allocation, risk management, and ensuring team synergy.", | |
| llm=openai_llm, | |
| verbose=True | |
| ) | |
| crew = Crew( | |
| agents=[researcher, writer, editor], | |
| tasks=[research_task, writing_task, editing_task], | |
| process="hierarchical", | |
| manager_agent=project_manager, # Using custom manager | |
| verbose=True | |
| )</div> | |
| <h3 class="text-xl font-semibold mt-6">Memory Systems</h3> | |
| <p class="mt-2"> | |
| CrewAI supports memory to enable agents to retain information across interactions: | |
| </p> | |
| <div class="code-block bg-black-800 text-white">from crewai import Crew | |
| crew = Crew( | |
| agents=[researcher, writer], | |
| tasks=[research_task, writing_task], | |
| memory=True, # Enable memory | |
| verbose=True | |
| ) | |
| # Memory is particularly useful for multi-session interactions | |
| result_day1 = crew.kickoff(inputs={"topic": "Quantum Computing Part 1"}) | |
| # Later session continues with awareness of previous work | |
| result_day2 = crew.kickoff(inputs={"topic": "Quantum Computing Part 2"})</div> | |
| <h3 class="text-xl font-semibold mt-6">Structured Outputs</h3> | |
| <p class="mt-2"> | |
| Get structured data from your crews using Pydantic models: | |
| </p> | |
| <div class="code-block bg-black-800 text-white">from pydantic import BaseModel, Field | |
| from typing import List | |
| from crewai import Task | |
| class ResearchFindings(BaseModel): | |
| topic: str = Field(description="The main topic of research") | |
| key_points: List[str] = Field(description="List of main findings or points") | |
| sources: List[str] = Field(description="References and sources of information") | |
| future_directions: List[str] = Field(description="Suggested areas for further research") | |
| research_task = Task( | |
| description="Research quantum computing advances", | |
| expected_output="Structured research findings", | |
| agent=researcher, | |
| output_pydantic=ResearchFindings | |
| ) | |
| result = crew.kickoff() | |
| print(f"Topic: {result.pydantic.topic}") | |
| print(f"Key points: {result.pydantic.key_points}") | |
| print(f"Sources: {result.pydantic.sources}")</div> | |
| <h3 class="text-xl font-semibold mt-6">Asynchronous Execution</h3> | |
| <p class="mt-2"> | |
| Run tasks asynchronously for better performance: | |
| </p> | |
| <div class="code-block bg-black-800 text-white">from crewai import Task, Crew | |
| # Create tasks with async_execution flag | |
| async_research_task = Task( | |
| description="Research quantum computing", | |
| expected_output="Research findings", | |
| agent=researcher, | |
| async_execution=True # This task will run asynchronously | |
| ) | |
| # Use the async kickoff method | |
| import asyncio | |
| async def run_crew_async(): | |
| crew = Crew( | |
| agents=[researcher, writer], | |
| tasks=[async_research_task, writing_task] | |
| ) | |
| result = await crew.kickoff_async() | |
| return result | |
| # Run the async function | |
| result = asyncio.run(run_crew_async())</div> | |
| <h3 class="text-xl font-semibold mt-6">Task Guardrails</h3> | |
| <p class="mt-2"> | |
| Implement validation for task outputs: | |
| </p> | |
| <div class="code-block bg-black-800 text-white">from crewai import Task | |
| from typing import Tuple, Any | |
| def validate_research(output: str) -> Tuple[bool, Any]: | |
| """Validate research output meets quality criteria.""" | |
| # Check for minimum length | |
| if len(output) < 500: | |
| return False, "Research output is too short. Please provide more detailed information." | |
| # Check for sources | |
| if "References:" not in output and "Sources:" not in output: | |
| return False, "Missing references or sources. Please include sources for your research." | |
| # If all checks pass | |
| return True, output | |
| research_task = Task( | |
| description="Research quantum computing advances", | |
| expected_output="Comprehensive research with sources", | |
| agent=researcher, | |
| guardrail=validate_research # Add validation function | |
| )</div> | |
| <h3 class="text-xl font-semibold mt-6">Task Callbacks</h3> | |
| <p class="mt-2"> | |
| Execute custom functions after tasks complete: | |
| </p> | |
| <div class="code-block bg-black-800 text-white">from crewai import Task, Crew | |
| def post_research_callback(task_output): | |
| """Process research after completion.""" | |
| print(f"Research task completed with {len(task_output.raw)} characters") | |
| # Save to database, send notification, etc. | |
| with open("research_results.md", "w") as f: | |
| f.write(task_output.raw) | |
| return task_output | |
| research_task = Task( | |
| description="Research quantum computing advances", | |
| expected_output="Comprehensive research with sources", | |
| agent=researcher, | |
| callback=post_research_callback # Will execute after task completion | |
| ) | |
| # You can also set a callback for the entire crew | |
| def crew_step_callback(step_output): | |
| """Track each step of crew execution.""" | |
| print(f"Step completed: {step_output}") | |
| return step_output | |
| crew = Crew( | |
| agents=[researcher, writer], | |
| tasks=[research_task, writing_task], | |
| step_callback=crew_step_callback | |
| )</div> | |
| <h3 class="text-xl font-semibold mt-6">Planning</h3> | |
| <p class="mt-2"> | |
| Enable automatic planning for more complex workflows: | |
| </p> | |
| <div class="code-block bg-black-800 text-white">from crewai import Crew | |
| crew = Crew( | |
| agents=[researcher, writer, editor], | |
| tasks=[research_task, writing_task, editing_task], | |
| planning=True, # Enable automatic planning | |
| planning_llm=openai_llm, # Optional, specify LLM for planning | |
| verbose=True | |
| ) | |
| result = crew.kickoff()</div> | |
| <div class="tip mt-4"> | |
| <p><strong>Tip:</strong> Advanced features often require more careful configuration and testing. Start with simpler setups and gradually incorporate advanced features as you become more familiar with CrewAI.</p> | |
| </div> | |
| </section> | |
| <!-- Example Applications Section --> | |
| <section id="examples" class="section bg-white p-6 rounded-lg shadow"> | |
| <h2 class="text-2xl font-bold text-blue-800">6. Example Applications</h2> | |
| <p class="mt-3"> | |
| Let's explore some practical example applications that you can build with CrewAI. These examples demonstrate how to apply CrewAI's capabilities to solve real-world problems. | |
| </p> | |
| <h3 class="text-xl font-semibold mt-6">Business Plan Generator</h3> | |
| <div class="card p-4"> | |
| <h4 class="font-semibold text-blue-700 text-lg">Use Case: Generate a business plan for a startup idea</h4> | |
| <p class="mt-2"><strong>Agents:</strong></p> | |
| <ul class="list-disc pl-6 mt-1"> | |
| <li><strong>Market Research Analyst:</strong> Researches market trends, competitors, and customer needs</li> | |
| <li><strong>Technologist:</strong> Evaluates technical feasibility and implementation requirements</li> | |
| <li><strong>Business Consultant:</strong> Creates the final business plan with financial projections</li> | |
| </ul> | |
| <p class="mt-2"><strong>Workflow:</strong></p> | |
| <ol class="list-decimal pl-6 mt-1"> | |
| <li>Market Research Analyst analyzes the market demand for the proposed product</li> | |
| <li>Technologist evaluates the technology requirements based on market analysis</li> | |
| <li>Business Consultant creates a comprehensive business plan based on both analyses</li> | |
| </ol> | |
| <p class="mt-3 italic text-sm">Example input: "Generate a business plan for an AI-powered personal fitness coaching app that uses computer vision to track workouts and provide real-time feedback."</p> | |
| </div> | |
| <h3 class="text-xl font-semibold mt-6">Content Creation System</h3> | |
| <div class="card p-4"> | |
| <h4 class="font-semibold text-blue-700 text-lg">Use Case: Create blog posts, social media content, and email newsletters</h4> | |
| <p class="mt-2"><strong>Agents:</strong></p> | |
| <ul class="list-disc pl-6 mt-1"> | |
| <li><strong>Topic Researcher:</strong> Identifies trending topics and key information</li> | |
| <li><strong>Content Writer:</strong> Creates the main content in an engaging style</li> | |
| <li><strong>Editor:</strong> Reviews content for clarity, accuracy, and SEO optimization</li> | |
| <li><strong>Social Media Specialist:</strong> Crafts promotional snippets for different platforms</li> | |
| </ul> | |
| <p class="mt-2"><strong>Workflow:</strong></p> | |
| <ol class="list-decimal pl-6 mt-1"> | |
| <li>Topic Researcher identifies trending topics and gathers key information</li> | |
| <li>Content Writer creates the main content based on research</li> | |
| <li>Editor reviews and refines the content</li> | |
| <li>Social Media Specialist creates promotional material for different platforms</li> | |
| </ol> | |
| <p class="mt-3 italic text-sm">Example input: "Create content about sustainable living tips for urban apartment dwellers, including a blog post, Twitter thread, and newsletter."</p> | |
| </div> | |
| <h3 class="text-xl font-semibold mt-6">Trip Planner</h3> | |
| <div class="card p-4"> | |
| <h4 class="font-semibold text-blue-700 text-lg">Use Case: Create personalized travel itineraries</h4> | |
| <p class="mt-2"><strong>Agents:</strong></p> | |
| <ul class="list-disc pl-6 mt-1"> | |
| <li><strong>Destination Researcher:</strong> Researches attractions, accommodations, and local information</li> | |
| <li><strong>Travel Logistics Expert:</strong> Plans transportation, timing, and practical arrangements</li> | |
| <li><strong>Experience Curator:</strong> Personalizes the itinerary based on traveler preferences</li> | |
| </ul> | |
| <p class="mt-2"><strong>Workflow:</strong></p> | |
| <ol class="list-decimal pl-6 mt-1"> | |
| <li>Destination Researcher gathers information about the location</li> | |
| <li>Travel Logistics Expert creates a feasible schedule with transportation</li> | |
| <li>Experience Curator customizes the plan based on preferences and provides the final itinerary</li> | |
| </ol> | |
| <p class="mt-3 italic text-sm">Example input: "Plan a 5-day trip to Tokyo for a family of four with children aged 8 and 12 who are interested in technology, anime, and outdoor activities. Budget: moderate."</p> | |
| </div> | |
| <h3 class="text-xl font-semibold mt-6">Market Analysis Report</h3> | |
| <div class="card p-4"> | |
| <h4 class="font-semibold text-blue-700 text-lg">Use Case: Analyze a specific market or industry</h4> | |
| <p class="mt-2"><strong>Agents:</strong></p> | |
| <ul class="list-disc pl-6 mt-1"> | |
| <li><strong>Industry Researcher:</strong> Gathers data on market trends, size, and growth</li> | |
| <li><strong>Competitive Analyst:</strong> Analyzes key competitors and market dynamics</li> | |
| <li><strong>Financial Analyst:</strong> Reviews financial aspects and investment potential</li> | |
| <li><strong>Report Writer:</strong> Creates the final comprehensive report</li> | |
| </ul> | |
| <p class="mt-2"><strong>Workflow:</strong></p> | |
| <ol class="list-decimal pl-6 mt-1"> | |
| <li>Industry Researcher collects market data and trends</li> | |
| <li>Competitive Analyst evaluates the competitive landscape</li> | |
| <li>Financial Analyst reviews the financial potential and risks</li> | |
| <li>Report Writer compiles all analyses into a cohesive report</li> | |
| </ol> | |
| <p class="mt-3 italic text-sm">Example input: "Create a market analysis report for the electric vehicle charging infrastructure industry in Europe, focusing on growth opportunities for the next 5 years."</p> | |
| </div> | |
| <div class="tip mt-6"> | |
| <p><strong>Tip for Implementation:</strong> Start with a simplified version of these examples with just 2-3 agents, then expand as you become more comfortable with CrewAI. Focus on creating well-defined roles and clear task descriptions to ensure effective agent collaboration.</p> | |
| </div> | |
| </section> | |
| <!-- Cheatsheet Section --> | |
| <section id="cheatsheet" class="section bg-white p-6 rounded-lg shadow"> | |
| <h2 class="text-2xl font-bold text-blue-800">7. CrewAI Cheatsheet</h2> | |
| <p class="mt-3"> | |
| This comprehensive cheatsheet provides quick reference for the most common CrewAI patterns and configurations. | |
| </p> | |
| <h3 class="text-xl font-semibold mt-4">Agent Creation Patterns</h3> | |
| <div class="code-block bg-black-800 text-white"># Basic Agent | |
| from crewai import Agent | |
| basic_agent = Agent( | |
| role="Researcher", | |
| goal="Find accurate information", | |
| backstory="You're an experienced researcher with expertise in data analysis." | |
| ) | |
| # Agent with Tools | |
| from crewai_tools import SerperDevTool | |
| search_tool = SerperDevTool() | |
| agent_with_tools = Agent( | |
| role="Researcher", | |
| goal="Find accurate information", | |
| backstory="You're an experienced researcher.", | |
| tools=[search_tool] | |
| ) | |
| # Agent with Custom LLM | |
| from langchain_openai import ChatOpenAI | |
| custom_llm = ChatOpenAI(model="gpt-4") | |
| agent_with_llm = Agent( | |
| role="Researcher", | |
| goal="Find accurate information", | |
| backstory="You're an experienced researcher.", | |
| llm=custom_llm | |
| ) | |
| # Agent with Delegation | |
| delegating_agent = Agent( | |
| role="Team Manager", | |
| goal="Coordinate research activities", | |
| backstory="You're a team manager with excellent delegation skills.", | |
| allow_delegation=True | |
| )</div> | |
| <h3 class="text-xl font-semibold mt-6">Task Creation Patterns</h3> | |
| <div class="code-block bg-black-800 text-white"># Basic Task | |
| from crewai import Task | |
| basic_task = Task( | |
| description="Research quantum computing advances", | |
| expected_output="Comprehensive research report", | |
| agent=researcher | |
| ) | |
| # Task with Tools | |
| task_with_tools = Task( | |
| description="Research quantum computing advances", | |
| expected_output="Comprehensive research report", | |
| agent=researcher, | |
| tools=[search_tool, web_scraper_tool] | |
| ) | |
| # Task with Context (Dependency) | |
| dependent_task = Task( | |
| description="Write an article based on research findings", | |
| expected_output="1500-word article", | |
| agent=writer, | |
| context=[research_task] # This task depends on research_task | |
| ) | |
| # Task with Structured Output | |
| from pydantic import BaseModel | |
| from typing import List | |
| class ResearchReport(BaseModel): | |
| title: str | |
| key_findings: List[str] | |
| sources: List[str] | |
| structured_task = Task( | |
| description="Research quantum computing advances", | |
| expected_output="Structured research report", | |
| agent=researcher, | |
| output_pydantic=ResearchReport | |
| ) | |
| # Task with File Output | |
| file_output_task = Task( | |
| description="Generate a research report", | |
| expected_output="Comprehensive markdown report", | |
| agent=researcher, | |
| output_file="output/research_report.md" | |
| ) | |
| # Asynchronous Task | |
| async_task = Task( | |
| description="Research quantum computing advances", | |
| expected_output="Research report", | |
| agent=researcher, | |
| async_execution=True | |
| ) | |
| # Task with Human Input | |
| human_review_task = Task( | |
| description="Create final research report", | |
| expected_output="Polished report", | |
| agent=editor, | |
| human_input=True | |
| )</div> | |
| <h3 class="text-xl font-semibold mt-6">Crew Creation Patterns</h3> | |
| <div class="code-block bg-black-800 text-white"># Sequential Crew (Default) | |
| from crewai import Crew | |
| sequential_crew = Crew( | |
| agents=[researcher, writer, editor], | |
| tasks=[research_task, writing_task, editing_task], | |
| verbose=True | |
| ) | |
| # Hierarchical Crew | |
| hierarchical_crew = Crew( | |
| agents=[researcher, writer, editor], | |
| tasks=[research_task, writing_task, editing_task], | |
| process="hierarchical", | |
| manager_llm=openai_llm, # Required for hierarchical process | |
| verbose=True | |
| ) | |
| # Crew with Custom Manager | |
| hierarchical_crew_custom_manager = Crew( | |
| agents=[researcher, writer, editor], | |
| tasks=[research_task, writing_task, editing_task], | |
| process="hierarchical", | |
| manager_agent=project_manager, # Custom manager agent | |
| verbose=True | |
| ) | |
| # Crew with Memory | |
| crew_with_memory = Crew( | |
| agents=[researcher, writer], | |
| tasks=[research_task, writing_task], | |
| memory=True, | |
| verbose=True | |
| ) | |
| # Crew with Full Output | |
| crew_with_full_output = Crew( | |
| agents=[researcher, writer, editor], | |
| tasks=[research_task, writing_task, editing_task], | |
| full_output=True # Return outputs from all tasks | |
| ) | |
| # Crew with Callbacks | |
| def task_complete_callback(task_output): | |
| print(f"Task completed: {task_output.description}") | |
| return task_output | |
| crew_with_callbacks = Crew( | |
| agents=[researcher, writer], | |
| tasks=[research_task, writing_task], | |
| task_callback=task_complete_callback | |
| )</div> | |
| <h3 class="text-xl font-semibold mt-6">Execution Patterns</h3> | |
| <div class="code-block bg-black-800 text-white"># Basic Kickoff | |
| result = crew.kickoff() | |
| print(result.raw) # Raw text output | |
| # Kickoff with Inputs | |
| result = crew.kickoff(inputs={"topic": "Quantum Computing"}) | |
| # Kickoff for Multiple Inputs | |
| inputs_array = [ | |
| {"topic": "Quantum Computing"}, | |
| {"topic": "Machine Learning"} | |
| ] | |
| results = crew.kickoff_for_each(inputs=inputs_array) | |
| # Asynchronous Kickoff | |
| import asyncio | |
| async def run_crew(): | |
| result = await crew.kickoff_async(inputs={"topic": "Quantum Computing"}) | |
| return result | |
| result = asyncio.run(run_crew()) | |
| # Accessing Structured Output | |
| if result.pydantic: | |
| print(f"Title: {result.pydantic.title}") | |
| print(f"Key findings: {result.pydantic.key_findings}") | |
| # Accessing All Task Outputs (with full_output=True) | |
| for task_output in result.tasks_output: | |
| print(f"Task: {task_output.description}") | |
| print(f"Output: {task_output.raw}") | |
| # Checking Token Usage | |
| print(f"Token usage: {result.token_usage}")</div> | |
| <h3 class="text-xl font-semibold mt-6">Common Tool Patterns</h3> | |
| <div class="code-block bg-black-800 text-white"># Search Tool | |
| from crewai_tools import SerperDevTool | |
| search_tool = SerperDevTool() | |
| # Web Scraping | |
| from crewai_tools import ScrapeWebsiteTool | |
| scrape_tool = ScrapeWebsiteTool() | |
| # Document Search Tools | |
| from crewai_tools import PDFSearchTool, CSVSearchTool | |
| pdf_tool = PDFSearchTool(pdf_path="data/research.pdf") | |
| csv_tool = CSVSearchTool(csv_path="data/statistics.csv") | |
| # Code Interpreter | |
| from crewai_tools import CodeInterpreterTool | |
| code_tool = CodeInterpreterTool() | |
| # Custom Tool using Decorator | |
| from crewai.tools import tool | |
| @tool | |
| def calculate_roi(investment: float, return_value: float) -> str: | |
| """ | |
| Calculate Return on Investment (ROI) | |
| Args: | |
| investment: Initial investment amount | |
| return_value: Value returned from the investment | |
| Returns: | |
| ROI as a percentage | |
| """ | |
| roi = (return_value - investment) / investment * 100 | |
| return f"ROI: {roi:.2f}%"</div> | |
| <h3 class="text-xl font-semibold mt-6">Troubleshooting Checklist</h3> | |
| <div class="overflow-x-auto"> | |
| <table class="reference-table"> | |
| <thead> | |
| <tr> | |
| <th>Issue</th> | |
| <th>Potential Cause</th> | |
| <th>Solution</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr> | |
| <td>Agent not using tools</td> | |
| <td>Tools not properly defined or not clearly needed in task</td> | |
| <td>Be more explicit in task description about using tools; check tool setup</td> | |
| </tr> | |
| <tr> | |
| <td>Tasks executed out of order</td> | |
| <td>Task dependencies not properly defined</td> | |
| <td>Ensure context is properly set for dependent tasks</td> | |
| </tr> | |
| <tr> | |
| <td>API key errors</td> | |
| <td>Missing or incorrect environment variables</td> | |
| <td>Check .env file and verify API keys are set correctly</td> | |
| </tr> | |
| <tr> | |
| <td>Poor agent performance</td> | |
| <td>Unclear role, goal, or backstory</td> | |
| <td>Make agent definitions more specific and detailed</td> | |
| </tr> | |
| <tr> | |
| <td>Timeout errors</td> | |
| <td>Tasks too complex or API rate limits</td> | |
| <td>Break into smaller tasks; implement max_rpm or retry logic</td> | |
| </tr> | |
| <tr> | |
| <td>Hierarchical process failing</td> | |
| <td>Missing manager_llm or poorly defined manager</td> | |
| <td>Ensure manager_llm is set or provide a well-defined manager_agent</td> | |
| </tr> | |
| <tr> | |
| <td>Tool execution errors</td> | |
| <td>Missing dependencies or incorrect usage</td> | |
| <td>Check tool documentation and required dependencies</td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| </div> | |
| </section> | |
| <!-- Best Practices Section --> | |
| <section id="best-practices" class="section bg-white p-6 rounded-lg shadow"> | |
| <h2 class="text-2xl font-bold text-blue-800">8. Best Practices</h2> | |
| <p class="mt-3"> | |
| These best practices will help you build more effective and efficient CrewAI applications. | |
| </p> | |
| <h3 class="text-xl font-semibold mt-6">Agent Design</h3> | |
| <div class="card"> | |
| <h4 class="font-semibold text-blue-700"><i class="fas fa-user-tag mr-2"></i>Define Specialized Roles</h4> | |
| <p>Create agents with distinct, non-overlapping roles for clearer responsibility distribution. Each agent should have a specific area of expertise.</p> | |
| <div class="mt-2 text-sm bg-black-100 p-2 rounded"> | |
| <span class="font-semibold">Example:</span> Instead of having two general "researchers," create a "Data Analyst" focusing on statistics and a "Industry Expert" focusing on domain knowledge. | |
| </div> | |
| </div> | |
| <div class="card mt-4"> | |
| <h4 class="font-semibold text-blue-700"><i class="fas fa-bullseye mr-2"></i>Craft Actionable Goals</h4> | |
| <p>Create specific, measurable goals that guide agent behavior. Vague goals lead to unfocused actions.</p> | |
| <div class="mt-2 text-sm bg-black-100 p-2 rounded"> | |
| <span class="font-semibold">Good:</span> "Identify the top 5 trends in renewable energy with supporting data points"<br> | |
| <span class="font-semibold">Not as good:</span> "Research renewable energy trends" | |
| </div> | |
| </div> | |
| <div class="card mt-4"> | |
| <h4 class="font-semibold text-blue-700"><i class="fas fa-book mr-2"></i>Develop Detailed Backstories</h4> | |
| <p>Rich backstories provide context for decision-making and shape agent personality.</p> | |
| <div class="mt-2 text-sm bg-black-100 p-2 rounded"> | |
| <span class="font-semibold">Good:</span> "You're a financial analyst with 15 years of experience in startup valuation. You've worked with VC firms and have helped assess over 200 startups. You're particularly skilled at identifying financial risks and market opportunities."<br> | |
| <span class="font-semibold">Not as good:</span> "You're a financial expert who understands startups." | |
| </div> | |
| </div> | |
| <h3 class="text-xl font-semibold mt-6">Task Design</h3> | |
| <div class="card"> | |
| <h4 class="font-semibold text-blue-700"><i class="fas fa-tasks mr-2"></i>Create Granular Tasks</h4> | |
| <p>Break complex processes into smaller, focused tasks for better management and performance.</p> | |
| <div class="mt-2 text-sm bg-black-100 p-2 rounded"> | |
| <span class="font-semibold">Instead of:</span> One task for "Research and write a complete report on renewable energy"<br> | |
| <span class="font-semibold">Consider:</span> Separate tasks for research, analysis, outline creation, drafting, and editing. | |
| </div> | |
| </div> | |
| <div class="card mt-4"> | |
| <h4 class="font-semibold text-blue-700"><i class="fas fa-list-ul mr-2"></i>Provide Clear Instructions</h4> | |
| <p>Include specific formats, requirements, and examples in task descriptions.</p> | |
| <div class="mt-2 text-sm bg-black-100 p-2 rounded"> | |
| <span class="font-semibold">Good:</span> "Create a 5-section report with an executive summary, market overview, competitor analysis, opportunities, and recommendations. Each section should be 300-500 words and include specific examples."<br> | |
| <span class="font-semibold">Not as good:</span> "Write a comprehensive report on the topic." | |
| </div> | |
| </div> | |
| <div class="card mt-4"> | |
| <h4 class="font-semibold text-blue-700"><i class="fas fa-sitemap mr-2"></i>Design Logical Task Flows</h4> | |
| <p>Create dependencies that mimic natural information flow and decision processes.</p> | |
| <div class="mt-2 text-sm bg-black-100 p-2 rounded"> | |
| <span class="font-semibold">Example flow:</span> Market Research → Technical Feasibility → Financial Projections → Business Plan → Executive Summary | |
| </div> | |
| </div> | |
| <h3 class="text-xl font-semibold mt-6">Crew Orchestration</h3> | |
| <div class="card"> | |
| <h4 class="font-semibold text-blue-700"><i class="fas fa-project-diagram mr-2"></i>Start Simple, Then Expand</h4> | |
| <p>Begin with 2-3 agents and a sequential process, then gradually add complexity.</p> | |
| <div class="mt-2 text-sm bg-black-100 p-2 rounded"> | |
| <span class="font-semibold">Iterative approach:</span> Start with researcher + writer; once working well, add editor and refiner roles. | |
| </div> | |
| </div> | |
| <div class="card mt-4"> | |
| <h4 class="font-semibold text-blue-700"><i class="fas fa-tools mr-2"></i>Equip Agents with Appropriate Tools</h4> | |
| <p>Match tools to agent specializations and task requirements.</p> | |
| <div class="mt-2 text-sm bg-black-100 p-2 rounded"> | |
| <span class="font-semibold">Example:</span> Equip research agents with search and web scraping tools; financial analysts with calculation tools; writers with content generation tools. | |
| </div> | |
| </div> | |
| <div class="card mt-4"> | |
| <h4 class="font-semibold text-blue-700"><i class="fas fa-bug mr-2"></i>Implement Error Handling</h4> | |
| <p>Use guardrails and validation to ensure quality outputs.</p> | |
| <div class="mt-2 text-sm bg-black-100 p-2 rounded"> | |
| <span class="font-semibold">Example:</span> Add validation for research outputs to ensure they include proper citations; implement length checks for content; verify that reports include all required sections. | |
| </div> | |
| </div> | |
| <h3 class="text-xl font-semibold mt-6">Performance Optimization</h3> | |
| <div class="card"> | |
| <h4 class="font-semibold text-blue-700"><i class="fas fa-tachometer-alt mr-2"></i>Use Appropriate LLMs</h4> | |
| <p>Match LLM capabilities to agent requirements and complexity.</p> | |
| <div class="mt-2 text-sm bg-black-100 p-2 rounded"> | |
| <span class="font-semibold">Strategy:</span> Use more powerful models (like GPT-4) for complex reasoning tasks and manager roles; use faster models for simpler tasks. | |
| </div> | |
| </div> | |
| <div class="card mt-4"> | |
| <h4 class="font-semibold text-blue-700"><i class="fas fa-database mr-2"></i>Implement Caching</h4> | |
| <p>Enable caching to reduce redundant tool executions and improve performance.</p> | |
| <div class="mt-2 text-sm bg-black-100 p-2 rounded"> | |
| <span class="font-semibold">Example:</span> Enable cache at both the crew and agent levels, especially for search operations and data retrieval that might be repeated. | |
| </div> | |
| </div> | |
| <div class="card mt-4"> | |
| <h4 class="font-semibold text-blue-700"><i class="fas fa-code-branch mr-2"></i>Use Asynchronous Execution</h4> | |
| <p>Leverage async capabilities for independent tasks to improve throughput.</p> | |
| <div class="mt-2 text-sm bg-black-100 p-2 rounded"> | |
| <span class="font-semibold">Example:</span> Mark independent research tasks as async_execution=True and use kickoff_async() for parallel processing. | |
| </div> | |
| </div> | |
| <div class="tip mt-6"> | |
| <p><strong>Key Takeaway:</strong> The most effective CrewAI applications are those that thoughtfully distribute specialized work across agents with clear goals, logical task dependencies, and appropriate tools. Start simple and iterate toward more complex systems as you gain experience.</p> | |
| </div> | |
| </section> | |
| <!-- Resources Section --> | |
| <section id="resources" class="section bg-white p-6 rounded-lg shadow"> | |
| <h2 class="text-2xl font-bold text-blue-800">9. Additional Resources</h2> | |
| <p class="mt-3"> | |
| Continue your learning journey with these valuable CrewAI resources. | |
| </p> | |
| <h3 class="text-xl font-semibold mt-6">Official Resources</h3> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-3"> | |
| <a href="https://docs.crewai.com" target="_blank" class="card hover:bg-blue-50 flex items-start transition-colors"> | |
| <div class="rounded-full bg-blue-100 p-3 mr-3"> | |
| <i class="fas fa-book text-blue-600"></i> | |
| </div> | |
| <div> | |
| <h4 class="font-semibold text-blue-700">Official Documentation</h4> | |
| <p class="text-sm">Comprehensive guides, API references, and examples</p> | |
| </div> | |
| </a> | |
| <a href="https://github.com/crewAIInc/crewAI" target="_blank" class="card hover:bg-blue-50 flex items-start transition-colors"> | |
| <div class="rounded-full bg-blue-100 p-3 mr-3"> | |
| <i class="fab fa-github text-blue-600"></i> | |
| </div> | |
| <div> | |
| <h4 class="font-semibold text-blue-700">GitHub Repository</h4> | |
| <p class="text-sm">Source code, issues, and contributions</p> | |
| </div> | |
| </a> | |
| <a href="https://github.com/crewAIInc/crewAI-examples" target="_blank" class="card hover:bg-blue-50 flex items-start transition-colors"> | |
| <div class="rounded-full bg-blue-100 p-3 mr-3"> | |
| <i class="fas fa-code text-blue-600"></i> | |
| </div> | |
| <div> | |
| <h4 class="font-semibold text-blue-700">Example Applications</h4> | |
| <p class="text-sm">Ready-to-use examples for various use cases</p> | |
| </div> | |
| </a> | |
| <a href="https://github.com/crewAIInc/crewAI-tools" target="_blank" class="card hover:bg-blue-50 flex items-start transition-colors"> | |
| <div class="rounded-full bg-blue-100 p-3 mr-3"> | |
| <i class="fas fa-tools text-blue-600"></i> | |
| </div> | |
| <div> | |
| <h4 class="font-semibold text-blue-700">CrewAI Tools</h4> | |
| <p class="text-sm">Repository of tools to enhance agent capabilities</p> | |
| </div> | |
| </a> | |
| </div> | |
| <h3 class="text-xl font-semibold mt-6">Community Resources</h3> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-3"> | |
| <a href="https://www.youtube.com/watch?v=7GhWXODugWM" target="_blank" class="card hover:bg-blue-50 flex items-start transition-colors"> | |
| <div class="rounded-full bg-blue-100 p-3 mr-3"> | |
| <i class="fab fa-youtube text-blue-600"></i> | |
| </div> | |
| <div> | |
| <h4 class="font-semibold text-blue-700">CrewAI RAG Deep Dive</h4> | |
| <p class="text-sm">Detailed tutorial on implementing RAG with CrewAI</p> | |
| </div> | |
| </a> | |
| <a href="https://medium.com/@sahin.samia/building-ai-agents-with-crewai-a-step-by-step-guide-172627e110c5" target="_blank" class="card hover:bg-blue-50 flex items-start transition-colors"> | |
| <div class="rounded-full bg-blue-100 p-3 mr-3"> | |
| <i class="fab fa-medium text-blue-600"></i> | |
| </div> | |
| <div> | |
| <h4 class="font-semibold text-blue-700">Step-by-Step Guide</h4> | |
| <p class="text-sm">Detailed Medium article on building AI agents with CrewAI</p> | |
| </div> | |
| </a> | |
| <a href="https://www.reddit.com/r/crewai/" target="_blank" class="card hover:bg-blue-50 flex items-start transition-colors"> | |
| <div class="rounded-full bg-blue-100 p-3 mr-3"> | |
| <i class="fab fa-reddit text-blue-600"></i> | |
| </div> | |
| <div> | |
| <h4 class="font-semibold text-blue-700">Reddit Community</h4> | |
| <p class="text-sm">Discussion forum for CrewAI users and developers</p> | |
| </div> | |
| </a> | |
| <a href="https://learn.deeplearning.ai/courses/practical-multi-ai-agents-and-advanced-use-cases-with-crewai/lesson/agfnp/introduction" target="_blank" class="card hover:bg-blue-50 flex items-start transition-colors"> | |
| <div class="rounded-full bg-blue-100 p-3 mr-3"> | |
| <i class="fas fa-graduation-cap text-blue-600"></i> | |
| </div> | |
| <div> | |
| <h4 class="font-semibold text-blue-700">DeepLearning.AI Course</h4> | |
| <p class="text-sm">Practical Multi AI Agents course with CrewAI</p> | |
| </div> | |
| </a> | |
| </div> | |
| <h3 class="text-xl font-semibold mt-6">Related Technologies</h3> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-3"> | |
| <a href="https://python.langchain.com/docs/integrations/tools" target="_blank" class="card hover:bg-blue-50 flex items-start transition-colors"> | |
| <div class="rounded-full bg-blue-100 p-3 mr-3"> | |
| <i class="fas fa-link text-blue-600"></i> | |
| </div> | |
| <div> | |
| <h4 class="font-semibold text-blue-700">LangChain Tools</h4> | |
| <p class="text-sm">Compatible tools that can be used with CrewAI</p> | |
| </div> | |
| </a> | |
| <a href="https://github.com/microsoft/autogen" target="_blank" class="card hover:bg-blue-50 flex items-start transition-colors"> | |
| <div class="rounded-full bg-blue-100 p-3 mr-3"> | |
| <i class="fas fa-robot text-blue-600"></i> | |
| </div> | |
| <div> | |
| <h4 class="font-semibold text-blue-700">AutoGen</h4> | |
| <p class="text-sm">Another multi-agent framework for comparison</p> | |
| </div> | |
| </a> | |
| </div> | |
| </section> | |
| </div> | |
| </div> | |
| </div> | |
| <footer class="bg-black-800 text-white p-6 mt-8"> | |
| <div class="container mx-auto"> | |
| <div class="text-center"> | |
| <h3 class="text-xl font-bold mb-2">CrewAI Learning Platform & Cheatsheet</h3> | |
| <p class="mb-4">A comprehensive guide to building multi-agent systems with CrewAI</p> | |
| <p class="text-gray-400 text-sm">Created with ❤️ for the CrewAI community</p> | |
| </div> | |
| </div> | |
| </footer> | |
| <script> | |
| // Simple highlighting for TOC | |
| document.addEventListener('DOMContentLoaded', function() { | |
| const sections = document.querySelectorAll('section[id]'); | |
| const tocLinks = document.querySelectorAll('.toc-link'); | |
| function highlightTOC() { | |
| let scrollPosition = window.scrollY; | |
| sections.forEach(section => { | |
| const sectionTop = section.offsetTop - 100; | |
| const sectionHeight = section.offsetHeight; | |
| const sectionId = section.getAttribute('id'); | |
| if (scrollPosition >= sectionTop && scrollPosition < sectionTop + sectionHeight) { | |
| // Remove active class from all links | |
| tocLinks.forEach(link => { | |
| link.classList.remove('toc-active'); | |
| }); | |
| // Add active class to current section's link | |
| const activeLink = document.querySelector(`.toc-link[href="#${sectionId}"]`); | |
| if (activeLink) { | |
| activeLink.classList.add('toc-active'); | |
| } | |
| } | |
| }); | |
| } | |
| window.addEventListener('scroll', highlightTOC); | |
| highlightTOC(); // Initialize on load | |
| // Smooth scrolling for TOC links | |
| tocLinks.forEach(link => { | |
| link.addEventListener('click', function(e) { | |
| e.preventDefault(); | |
| const targetId = this.getAttribute('href'); | |
| const targetElement = document.querySelector(targetId); | |
| window.scrollTo({ | |
| top: targetElement.offsetTop - 20, | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); | |
| }); | |
| </script> | |
| </body> | |
| </html> | |