Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:CrewAIInc CrewAI Crew Training Config

From Leeroopedia

Overview

Concrete Crew configuration with verbose logging, memory, and caching enabled for training and evaluation workflows provided by the CrewAI framework.

Source

src/crewai/crew.py:L133-326, L375-401

Key Parameters

The Crew class exposes several configuration parameters that form the training baseline. These are defined as Pydantic model fields on the Crew class:

Parameter Type Default Description
verbose bool False Enable detailed logging of agent reasoning and tool usage
memory bool False Enable memory subsystem (ShortTermMemory, LongTermMemory, EntityMemory)
cache bool True Enable tool result caching for efficiency
process Process Process.sequential Execution process type (sequential or hierarchical)
agents list[Agent] required List of agents in the crew
tasks list[Task] required List of tasks for the crew to execute

When memory=True is set, the Crew initializer (in the _setup_memory validator) creates:

  • ShortTermMemory — Vector-based storage (ChromaDB) for recent interactions within the current session
  • LongTermMemory — SQLite-based storage for task-level insights persisted across sessions
  • EntityMemory — Vector-based storage for entity relationships and facts

Import

from crewai import Crew, Agent, Task, Process

Example

The following example shows a Crew configured as a training baseline with verbose logging, memory, and caching all enabled:

from crewai import Crew, Agent, Task, Process

# Define agents
researcher = Agent(
    role="Senior Research Analyst",
    goal="Uncover cutting-edge developments in {topic}",
    backstory="You are an expert research analyst with deep knowledge of technology trends.",
    verbose=True,
    allow_delegation=False,
)

writer = Agent(
    role="Content Writer",
    goal="Craft compelling content about {topic}",
    backstory="You are a skilled writer who transforms research into engaging articles.",
    verbose=True,
    allow_delegation=False,
)

# Define tasks
research_task = Task(
    description="Conduct thorough research about {topic} and identify key trends.",
    expected_output="A detailed research report with key findings and trends.",
    agent=researcher,
)

writing_task = Task(
    description="Write a comprehensive article based on the research about {topic}.",
    expected_output="A well-structured article suitable for publication.",
    agent=writer,
)

# Configure crew with training baseline
crew = Crew(
    agents=[researcher, writer],
    tasks=[research_task, writing_task],
    process=Process.sequential,
    verbose=True,   # Enable detailed logging for training observation
    memory=True,    # Enable memory subsystem for cross-iteration learning
    cache=True,     # Enable caching for efficiency during repeated runs
)

Internal Behavior

When the Crew is instantiated with these parameters:

  1. The verbose flag is propagated to all agents and the execution engine, enabling detailed logging of each agent's reasoning chain, tool invocations, and task completions.
  2. The memory flag triggers the _setup_memory validator which initializes the three memory stores (ShortTermMemory, LongTermMemory, EntityMemory) and optionally a UserMemory if user memory configuration is provided.
  3. The cache flag enables the CacheHandler, which stores and retrieves tool results by input hash, preventing redundant tool executions across iterations.

Principle

Principle:CrewAIInc_CrewAI_Baseline_Crew_Configuration

References

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment