CrewAI Planning

CrewAI Planning (플래닝)

크루가 태스크를 실행하기 전에 미리 계획을 세우게 하면 결과물 품질이 크게 올라가요. CrewAI의 planning 기능은 크루에 계획 능력을 추가해, 각 실행 전에 모든 크루 정보를 AgentPlanner에 보내 태스크를 단계별로 계획하고, 그 계획을 각 태스크 설명에 덧붙입니다. 크루에 planning=True 한 줄만 추가하면 되는 간단한 기능이에요.

출처: 공식문서

본문

Planning 기능 사용하기

planning 기능을 시작하는 것은 아주 간단합니다. 크루에 planning=True만 추가하면 돼요.

from crewai import Crew, Agent, Task, Process

# Assemble your crew with planning capabilities
my_crew = Crew(
    agents=self.agents,
    tasks=self.tasks,
    process=Process.sequential,
    planning=True,
)

이 시점부터 크루에 planning이 활성화되고, 각 반복 전에 태스크가 계획됩니다.

planning이 켜지면 crewAI는 기본적으로 gpt-4o-mini를 플래닝 LLM으로 사용하므로 유효한 OpenAI API 키가 필요합니다. 에이전트들이 다른 LLM을 쓰고 있을 수 있기 때문에, OpenAI API 키가 없거나 LLM API 호출과 관련된 예상치 못한 동작이 있다면 혼란스러울 수 있어요.

Planning LLM

태스크를 계획하는 데 사용할 LLM을 지정할 수도 있습니다.

from crewai import Crew, Agent, Task, Process

# Assemble your crew with planning capabilities and custom LLM
my_crew = Crew(
    agents=self.agents,
    tasks=self.tasks,
    process=Process.sequential,
    planning=True,
    planning_llm="gpt-4o"
)

# Run the crew
my_crew.kickoff()

기본 사례를 실행하면 AgentPlanner가 생성하는 단계별 계획 로직이 콘솔에 출력됩니다.

[2024-07-15 16:49:11][INFO]: Planning the crew execution
**Step-by-Step Plan for Task Execution**

**Task Number 1: Conduct a thorough research about AI LLMs**

**Agent:** AI LLMs Senior Data Researcher

**Agent Goal:** Uncover cutting-edge developments in AI LLMs

**Task Expected Output:** A list with 10 bullet points of the most relevant information about AI LLMs

**Task Tools:** None specified

**Agent Tools:** None specified

**Step-by-Step Plan:**

1. **Define Research Scope:**

   - Determine the specific areas of AI LLMs to focus on, such as advancements in architecture, use cases, ethical considerations, and performance metrics.

2. **Identify Reliable Sources:**

   - List reputable sources for AI research, including academic journals, industry reports, conferences (e.g., NeurIPS, ACL), AI research labs (e.g., OpenAI, Google AI), and online databases (e.g., IEEE Xplore, arXiv).

3. **Collect Data:**

   - Search for the latest papers, articles, and reports published in 2024 and early 2025.
   - Use keywords like "Large Language Models 2025", "AI LLM advancements", "AI ethics 2025", etc.

4. **Analyze Findings:**

   - Read and summarize the key points from each source.
   - Highlight new techniques, models, and applications introduced in the past year.

5. **Organize Information:**

   - Categorize the information into relevant topics (e.g., new architectures, ethical implications, real-world applications).
   - Ensure each bullet point is concise but informative.

6. **Create the List:**

   - Compile the 10 most relevant pieces of information into a bullet point list.
   - Review the list to ensure clarity and relevance.

**Expected Output:**

  A list with 10 bullet points of the most relevant information about AI LLMs.

이처럼 planning이 켜지면 각 크루 실행 전에 AgentPlanner가 태스크 목표·에이전트·도구를 고려한 단계별 계획을 만들어 모든 에이전트의 태스크에 주입합니다. 복잡하거나 다단계인 크루일수록 이 사전 계획이 결과 일관성에 도움이 돼요.

더 알아보기