Prev Next

AI / CrewAI Interview Questions II

Could not find what you were looking for? send us the question and we would be happy to answer your question.

1. Which is better and why: a single Crew vs combining multiple Crews inside a Flow for a complex pipeline?

Single CrewMultiple Crews inside a Flow
Simpler to set up for a self-contained taskMore setup, but handles genuinely multi-stage pipelines
One process governs the whole task, sequential or hierarchicalEach stage can use whichever process fits it best
Less explicit control over what happens between stagesFlow's @start/@listen/@router give explicit control over transitions between crews
Harder to add persistence or human review mid-pipelineNaturally supports @persist and @human_feedback at stage boundaries

Neither is universally better. A single crew is the right choice when a task is genuinely self-contained and doesn't need distinct stages with different coordination needs. As soon as a pipeline has clearly separate stages, like research, then drafting, then review, that benefit from different processes, explicit state, or a human checkpoint between them, combining multiple crews inside a Flow is the pattern CrewAI's own architecture is built to support, described as the point where its power truly shows.

When is a single Crew the right choice?
What can multiple Crews inside a Flow naturally support at stage boundaries?

2. Explain the internal working of CrewAI's memory system when memory=True is set?

flowchart LR A[Crew Created with memory=True] --> B[Default ShortTermMemory Instance] A --> C[Default LongTermMemory Instance] A --> D[Default EntityMemory Instance] B --> E[Shared Embedder Config Applied] D --> E E --> F[ChromaDB Vector Storage Backend]
  1. When a Crew is instantiated with memory=True, CrewAI automatically constructs default instances of ShortTermMemory, LongTermMemory, and EntityMemory rather than requiring each to be built manually
  2. The crew's embedder configuration is passed into the ShortTermMemory and EntityMemory constructors, since both rely on embeddings for similarity-based retrieval
  3. LongTermMemory is initialized without an embedder, since it isn't built around embedding-based similarity search the way the other two are
  4. ChromaDB serves as the default vector storage backend underlying this memory system, persisting the embedded data

This automatic wiring is what lets a single boolean flag produce a fully functioning three-tier memory system, while still leaving the door open to override any individual memory type with a custom instance when the defaults don't fit.

What three memory instances does memory=True automatically construct?
Which two memory types receive the crew's embedder configuration?

3. Explain the lifecycle of state persistence in a Flow using the @persist decorator?

flowchart LR A[Flow Starts] --> B[Unique UUID Assigned] B --> C[State Updated as Methods Execute] C --> D[@persist Writes State to Backing Store] D --> E{Interrupted?} E -->|Yes| F[State Reloaded from Store] F --> C E -->|No| G[Flow Completes]
  1. Initialization: a Flow instance is created and automatically assigned a unique identifier, a UUID, as part of its state
  2. Execution: as @start, @listen, and @router methods run, they read from and write to the Flow's state, whether unstructured as a dictionary or structured as a Pydantic model
  3. Persistence: with @persist applied to the Flow class, this state is written out to a backing store, SQLite by default, or PostgreSQL for multi-instance deployments, as execution proceeds
  4. Interruption: if the Flow is interrupted, whether by a crash, a deliberate pause such as @human_feedback, or a restart, its state isn't lost
  5. Recovery: on resumption, the Flow reloads its persisted state and continues rather than starting over from the beginning

This lifecycle is specifically what makes long-running or human-in-the-loop Flows viable in production, without it, any interruption would force the entire workflow to restart from scratch, discarding whatever progress had already been made.

What is assigned to a Flow instance automatically at initialization?
What happens on recovery after an interruption, with @persist applied?
«
»

Comments & Discussions