The interview question sounds simple: "You need to build an AI agent that can do X. Which framework would you use?"

Generic candidates name-drop LangChain and move on. Strong candidates reason through the trade-offs: control vs. abstraction, single-agent vs. multi-agent, graph-based vs. pipeline-based orchestration. Here's the complete framework comparison.

The Four Options

LangGraph (LangChain ecosystem)

Core model: Directed graph of nodes and edges. Each node is a function that reads/writes to a shared state object. Edges can be conditional (if/else routing based on state).

Best for: Complex, stateful workflows where you need fine-grained control over the execution path. Think: agents that need to loop, branch, or checkpoint mid-execution.

Trade-offs:

  • Pro: Native checkpointing and state persistence. You can pause an agent, serialize its state, and resume later — critical for long-running workflows.
  • Pro: Human-in-the-loop patterns are first-class. You can insert approval gates at any node.
  • Con: Steep learning curve. The graph abstraction adds cognitive overhead for simple use cases.
  • Con: Tight coupling to the LangChain ecosystem. If you need to swap out the LLM provider or add non-LangChain tools, you may fight the framework.

CrewAI

Core model: Role-based multi-agent system. You define "agents" with personas (Researcher, Writer, Editor) and assign them "tasks" with dependencies.

Best for: Multi-agent collaboration where the workflow maps naturally to human team roles. Common examples: content pipelines, research + synthesis workflows.

Trade-offs:

  • Pro: Intuitive mental model. Non-ML engineers can understand and contribute to agent definitions quickly.
  • Pro: Built-in task delegation and inter-agent communication.
  • Con: Less control over individual LLM calls. The framework abstracts away prompt construction, which makes debugging harder.
  • Con: Weaker state management compared to LangGraph. Not ideal for workflows that need mid-execution checkpointing.

AutoGen (Microsoft)

Core model: Conversational multi-agent framework. Agents communicate via message passing, with a "group chat" metaphor for multi-agent coordination.

Best for: Research-heavy, open-ended agent interactions. AutoGen excels when agents need to debate, critique each other's outputs, or converge on a solution through conversation.

Trade-offs:

  • Pro: Flexible conversation patterns. Agents can dynamically decide who speaks next.
  • Pro: Strong code execution sandboxing (Docker-based). Good for agents that write and run code.
  • Con: Conversation-based routing is unpredictable. Hard to guarantee deterministic execution paths.
  • Con: Token-heavy. Multi-agent conversations consume context window rapidly.

Custom Agent Loop (No Framework)

Core model: A while loop with an LLM call, tool dispatch, and state update. You write everything yourself.

Best for: Simple, single-purpose agents where framework overhead isn't justified. Also the right call when you need maximum control over every LLM call — e.g., in latency-sensitive production systems.

Trade-offs:

  • Pro: Zero framework lock-in. Full control over prompts, error handling, and retry logic.
  • Pro: Minimal dependencies. Easier to deploy, audit, and maintain in production.
  • Con: You're reimplementing checkpointing, state management, and human-in-the-loop from scratch.
  • Con: Hard to scale to multi-agent systems without building your own orchestration layer.

The Interview Answer Framework

When asked "Which framework would you use?", structure your answer like this:

  1. State the requirements. "For this use case, I need [stateful/stateless], [single/multi]-agent, with [checkpointing/no checkpointing]."
  2. Map requirements to framework strengths. "Given those requirements, [Framework X] is the best fit because…"
  3. Acknowledge the trade-off. "The downside is [specific weakness], which I'd mitigate by [concrete solution]."
  4. Mention the custom option. "If this is latency-critical or the workflow is straightforward, I'd consider a custom loop to avoid framework overhead."

Example: Generic Answer vs. Strong Answer

Question: "Design an agent that researches a topic, drafts an article, and self-edits until quality meets a threshold."

Generic: "I'd use LangChain because it's the most popular framework for building agents."

Strong: "This is a multi-step workflow with a feedback loop (research → draft → edit → re-evaluate). I'd use LangGraph because the graph model lets me define the edit→re-evaluate cycle as a conditional edge — the agent loops back to editing if quality is below the threshold. I'd add a max-iteration cap (say 3 rounds) to prevent infinite loops, and use LangGraph's checkpointing to persist state between iterations so I can resume if the process is interrupted. The trade-off is that LangGraph adds complexity — if the workflow were linear (no feedback loop), I'd use a simple custom pipeline instead."

Decision Matrix

Use this mental model in interviews to quickly map requirements to frameworks:

  • Need checkpointing / human-in-the-loop? → LangGraph
  • Multi-agent with clear role separation? → CrewAI
  • Agents that debate / critique each other? → AutoGen
  • Simple, single-purpose, latency-sensitive? → Custom loop
  • Production system with strict SLAs? → Custom loop or LangGraph (with careful abstraction)

Continue the Agentic AI Series:

Related: