How git-devisha/crewai works
Main Components
• • CLI & Project Bootstrap: Represented by the src/crewai/cli and the templates folders. This part manages the creation of new projects, configuration files (agents.yaml, tasks.yaml, etc.), and provides command-line commands for interacting with the system.
• • Core Framework Modules:
◦ Agents & Agent Builders: Found in src/crewai/agents and its submodules, including agent_builder and cache. These modules encapsulate the building, configuration, and execution of individual agents.
◦ Crews: The abstraction that groups agents together (see src/crewai/crews and the crew.py files). This module orchestrates task delegation, parallel/sequential execution, and overall crew coordination.
◦ Flows: Located in src/crewai/flow, handling the event-driven orchestration. This module defines how multiple tasks and agent executions interact in an event-based, sequential, or hierarchical process.
• • Memory Management: Multiple modules under src/crewai/memory (short‑term, long‑term, entity etc.) show how state and context are captured, stored, and recalled across tasks.
• • Knowledge & Knowledge Sources: Under src/crewai/knowledge, representing how external and internal data are processed (via different file formats like JSON, CSV, PDF) and embedded.
• • Tools & LLM Integrations: In src/crewai/tools and src/crewai/llms, these components encapsulate tool handling and connection to external language models (e.g., OpenAI API, or local alternatives) to let agents query and process language data.
• • Utilities, Logging, and Exception Handling: Diverse helper modules in src/crewai/utilities, events, and security provide support for error handling, logging, configuration management, and event bus communication (which is pivotal for flows and triggering tasks).
• • Telemetry & Security: Modules in src/crewai/telemetry and src/crewai/security manage data collection (with privacy in mind) as described in the README and ensure secure operation.
• • Tests: The tests directory shows unit, integration, and cassette-based tests, validating the correct behavior of both core and extended functionalities.
Relationships and Interactions
◦ The CLI layer (and project templates) initiate and bootstrap Crews/Flows.
◦ The Crew component orchestrates multiple agents by linking their task definitions (from agents.yaml and tasks.yaml) to the specific agent implementations.
◦ Agents interact with Memory, Knowledge, Tools, and External LLM APIs to process input and produce outputs.
◦ The Flow module uses event-listeners and decorators to chain task executions and introduce conditional branching (for example, based on telemetry or output evaluation).
◦ Telemetry/Security modules “listen” for events and capture logs, while utilities facilitate error handling and event propagation.
• That configuration (pyproject.toml, YAML config files, and environment variables from .env) is a core dependency across modules.
Architectural Patterns
• The design follows modular, layered architecture where independent components (agents, crews, flows) communicate via well-defined interfaces.
• Uses decorators (@agent, @task, @crew, @start, @listen, @router) to clearly separate concerns and control execution logic.
• There’s heavy reliance on event-driven and process-oriented design, making it easier to extend and swap workflow strategies (sequential, hierarchical, etc.).
Relevant Technologies and Frameworks
• Python (≥3.10 <3.13) as the base language.
• UV for dependency management.
• Optional integration with external LLM APIs (OpenAI, Serper.dev) and integration with tooling for CLI commands.
• Testing frameworks (pytest) and static analysis (mypy, ruff) are configured to maintain quality.