mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-07 07:08:31 +00:00
* docs: Fix major memory system documentation issues - Remove misleading deprecation warnings, fix confusing comments, clearly separate three memory approaches, provide accurate examples that match implementation * fix: Correct broken image paths in README - Update crewai_logo.png and asset.png paths to point to docs/images/ directory instead of docs/ directly * docs: Add system prompt transparency and customization guide - Add 'Understanding Default System Instructions' section to address black-box concerns - Document what CrewAI automatically injects into prompts - Provide code examples to inspect complete system prompts - Show 3 methods to override default instructions - Include observability integration examples with Langfuse - Add best practices for production prompt management * docs: Fix implementation accuracy issues in memory documentation - Fix Ollama embedding URL parameter and remove unsupported Cohere input_type parameter * docs: Reference observability docs instead of showing specific tool examples * docs: Reorganize knowledge documentation for better developer experience - Move quickstart examples right after overview for immediate hands-on experience - Create logical learning progression: basics → configuration → advanced → troubleshooting - Add comprehensive agent vs crew knowledge guide with working examples - Consolidate debugging and troubleshooting in dedicated section - Organize best practices by topic in accordion format - Improve content flow from simple concepts to advanced features - Ensure all examples are grounded in actual codebase implementation * docs: enhance custom LLM documentation with comprehensive examples and accurate imports * docs: reorganize observability tools into dedicated section with comprehensive overview and improved navigation * docs: rename how-to section to learn and add comprehensive overview page * docs: finalize documentation reorganization and update navigation labels * docs: enhance README with comprehensive badges, navigation links, and getting started video
90 lines
3.3 KiB
Plaintext
90 lines
3.3 KiB
Plaintext
---
|
|
title: Custom Manager Agent
|
|
description: Learn how to set a custom agent as the manager in CrewAI, providing more control over task management and coordination.
|
|
icon: user-shield
|
|
---
|
|
|
|
# Setting a Specific Agent as Manager in CrewAI
|
|
|
|
CrewAI allows users to set a specific agent as the manager of the crew, providing more control over the management and coordination of tasks.
|
|
This feature enables the customization of the managerial role to better fit your project's requirements.
|
|
|
|
## Using the `manager_agent` Attribute
|
|
|
|
### Custom Manager Agent
|
|
|
|
The `manager_agent` attribute allows you to define a custom agent to manage the crew. This agent will oversee the entire process, ensuring that tasks are completed efficiently and to the highest standard.
|
|
|
|
### Example
|
|
|
|
```python Code
|
|
import os
|
|
from crewai import Agent, Task, Crew, Process
|
|
|
|
# Define your agents
|
|
researcher = Agent(
|
|
role="Researcher",
|
|
goal="Conduct thorough research and analysis on AI and AI agents",
|
|
backstory="You're an expert researcher, specialized in technology, software engineering, AI, and startups. You work as a freelancer and are currently researching for a new client.",
|
|
allow_delegation=False,
|
|
)
|
|
|
|
writer = Agent(
|
|
role="Senior Writer",
|
|
goal="Create compelling content about AI and AI agents",
|
|
backstory="You're a senior writer, specialized in technology, software engineering, AI, and startups. You work as a freelancer and are currently writing content for a new client.",
|
|
allow_delegation=False,
|
|
)
|
|
|
|
# Define your task
|
|
task = Task(
|
|
description="Generate a list of 5 interesting ideas for an article, then write one captivating paragraph for each idea that showcases the potential of a full article on this topic. Return the list of ideas with their paragraphs and your notes.",
|
|
expected_output="5 bullet points, each with a paragraph and accompanying notes.",
|
|
)
|
|
|
|
# Define the manager agent
|
|
manager = Agent(
|
|
role="Project Manager",
|
|
goal="Efficiently manage the crew and ensure high-quality task completion",
|
|
backstory="You're an experienced project manager, skilled in overseeing complex projects and guiding teams to success. Your role is to coordinate the efforts of the crew members, ensuring that each task is completed on time and to the highest standard.",
|
|
allow_delegation=True,
|
|
)
|
|
|
|
# Instantiate your crew with a custom manager
|
|
crew = Crew(
|
|
agents=[researcher, writer],
|
|
tasks=[task],
|
|
manager_agent=manager,
|
|
process=Process.hierarchical,
|
|
)
|
|
|
|
# Start the crew's work
|
|
result = crew.kickoff()
|
|
```
|
|
|
|
## Benefits of a Custom Manager Agent
|
|
|
|
- **Enhanced Control**: Tailor the management approach to fit the specific needs of your project.
|
|
- **Improved Coordination**: Ensure efficient task coordination and management by an experienced agent.
|
|
- **Customizable Management**: Define managerial roles and responsibilities that align with your project's goals.
|
|
|
|
## Setting a Manager LLM
|
|
|
|
If you're using the hierarchical process and don't want to set a custom manager agent, you can specify the language model for the manager:
|
|
|
|
```python Code
|
|
from crewai import LLM
|
|
|
|
manager_llm = LLM(model="gpt-4o")
|
|
|
|
crew = Crew(
|
|
agents=[researcher, writer],
|
|
tasks=[task],
|
|
process=Process.hierarchical,
|
|
manager_llm=manager_llm
|
|
)
|
|
```
|
|
|
|
<Note>
|
|
Either `manager_agent` or `manager_llm` must be set when using the hierarchical process.
|
|
</Note> |