$ show crewAIInc/crewAI
CrewAI is a large, actively maintained Python framework for orchestrating autonomous AI agents and event-driven multi-agent workflows. The codebase is organized as a monorepo with six libraries under `lib/`: `crewai` (core framework), `crewai-cli` (CLI), `crewai-tools` (tool integrations), `crewai-files` (multimodal file handling), `crewai-core` (shared utilities), and `devtools` (release tooling). The core provides two complementary abstractions — Crews for autonomous role-based agent collaboration and Flows for precise, state-machine-driven orchestration — that can be combined in production applications. The framework supports numerous LLM providers (OpenAI, Anthropic, Gemini, Azure, Bedrock, and many more), a wide array of built-in and third-party tools, MCP/A2A protocol integrations, human-in-the-loop flows, and enterprise deployment via the AMP Suite. The repository has extensive test coverage (pytest with VCR cassettes), strong static analysis (ruff, mypy, bandit), and a well-defined release process. While the framework code is solid and well-structured, the repository is dominated by auto-generated documentation files (thousands of `.mdx` files across multiple versions and languages) and repetitive tool README templates, which inflate the file count but contribute little reusable engineering value.
The LLM identified 6 files worth highlighting for reuse:
The Flow class is the core implementation of CrewAI's event-driven workflow abstraction. It provides a Pythonic way to define stateful, multi-step processes using decorators like @start, @listen, and @router. Flows support conditional branching, parallel execution, state persistence, and resumability. This is a genuinely reusable pattern for building complex agentic workflows that combine deterministic control logic with autonomous agent execution. The implementation is clean, well-typed, and demonstrates non-trivial state management.
PlannerObserver implements the 'Observe' phase of a plan-execute-observe loop. After each step execution, it analyzes what happened, what new information was learned, and whether the remaining plan is still valid. It uses structured LLM output (StepObservation) to suggest lightweight refinements without requiring a second LLM call. This is a sophisticated implementation of the observe pattern that separates observation from execution, making it reusable for any agent system that needs to reason about plan progress.
The ServerExtension and ServerExtensionRegistry classes provide a clean, well-abstracted implementation of the A2A (Agent-to-Agent) protocol's server-side extension mechanism. Extensions allow agents to offer additional functionality beyond the core specification, with hooks for request/response processing. The code demonstrates proper separation of concerns, error isolation, and a registry pattern. This is genuinely reusable for any A2A protocol implementation.
The event bus implementation provides a publish-subscribe mechanism for agent, task, crew, and flow events. It supports typed event handlers, async listeners, and structured event types across the framework. This is a clean, reusable event bus pattern that decouples event producers from consumers, enabling extensible observability and tracing.
UnifiedMemory provides a storage-agnostic memory system for agents, supporting multiple backend implementations through a factory pattern. It handles memory scoping, concurrent access, and recall flows. The abstraction is well-designed for reuse in any agent system needing persistent, scoped memory with pluggable storage backends.
The flow template demonstrates the recommended pattern for building CrewAI Flows with structured state, crew integration, and trigger payload support. It shows how to combine autonomous crew execution within a deterministic flow, with proper state management and output handling. This is a well-crafted template that demonstrates best practices for the framework.