AI Agent Frameworks - Mental Models and Control Flow
Goal
Compare agent frameworks by their control flow, memory model, and tool execution patterns using a common problem: “Automatically detect, diagnose, and remediate a production outage in a microservices system.”
smolagents
Multi-step decision loop over tools.
Each iteration:
- App injects goal + memory + tools
- LLM returns one tool call or final answer
- App executes tool, appends result to memory
- Loop repeats
Memory: Python list/dict managed by your application
Tools: Pure API actions. Agent requests, never executes.
RAG: Just another tool:
retrieve(query) → documents
Approach:
## Expose tools: get_metrics, read_logs, restart_service, update_config
## One agent repeatedly:
## - observes system state
## - picks exactly one tool
## - applies it
## - continues until stable
One agent owns the entire reasoning loop.
LangChain + LangGraph
Graph-first architecture. You define nodes, edges, state, and flow. Agents only exist inside nodes when needed.
Memory: Structured state object, automatically passed between nodes
Tools: Inside agent nodes or as standalone graph nodes
RAG: First-class workflow pattern
Approach:
## State machine with nodes:
graph = StateGraph()
graph.add_node("detect_anomaly", detect_fn)
graph.add_node("identify_service", identify_fn)
graph.add_node("analyze_logs", analyze_fn)
graph.add_conditional_edges(
"analyze_logs",
route_decision,
{
"safe": "auto_restart",
"risk": "escalate",
"unresolved": "analyze_logs" # loop
}
)
The workflow owns the logic. Agents appear only in specific diagnostic nodes.
Microsoft Agents Framework
Stateful, long-lived, message-driven services. Agents behave like microservices with memory.
Memory: Built-in, durable, scoped per agent and user
Tools: Declared capabilities invoked via native function-calling
RAG: Enterprise integration with search indexes, vector DBs
Approach:
## Deploy persistent Incident Response Agent
## - Listens to alerts
## - Maintains long-term incident state
## - Coordinates remediation over hours
## - Interactive with humans
The platform owns orchestration and persistence.
AutoGen
Conversational agents with distinct roles. No central control loop—behavior emerges from dialogue.
Memory: Conversation transcripts + per-agent memory
Tools: Wrapped in tool agents, called via message passing
RAG: Via Retriever Agent feeding other agents
Approach:
## Create agent roles:
monitoring_agent = Agent("Monitor")
diagnosis_agent = Agent("Diagnostician")
remediation_agent = Agent("Executor")
verification_agent = Agent("Verifier")
## They discuss the outage, propose fixes, confirm outcomes
Conversation owns the workflow.
CrewAI
Role-based team members in a crew. Organizational model, not algorithmic.
Memory: Per-agent + optional shared crew context
Tools: Assigned per agent, executed during tasks
RAG: Common in research/synthesis roles
Approach:
crew = Crew(
agents=[
Agent(role="Incident Analyst", tools=[metrics_tool]),
Agent(role="Fix Executor", tools=[restart_tool]),
Agent(role="Validator", tools=[health_check_tool]),
Agent(role="Communications", tools=[notify_tool])
],
tasks=[detect_task, fix_task, validate_task, notify_task]
)
Role-based delegation owns execution.
Auto-GPT
Fully autonomous agent. Decomposes goals, executes, reflects, spawns subtasks, iterates. No explicit workflow design.
Memory: Vector DB + filesystem + scratchpad
Tools: Shell, web browsing, APIs, local actions
RAG: Emergent, not formally structured
Approach:
## Goal: "Restore system stability"
## Agent invents:
## - diagnostic steps
## - tries fixes
## - reflects on results
## - continues until done
The agent invents the plan.
OpenAI Agents SDK
Hosted function-calling system with built-in orchestration. LLM-native service orchestrator.
SDK abstracts: control loops, tool routing, multi-step reasoning, execution environment.
Memory: Message-based context. External state stores if needed.
Tools: Python functions with schema enforcement
RAG: Via retrieval tools or Assistants + vector stores
Approach:
def get_metrics(service: str) -> dict: ...
def inspect_logs(service: str, lines: int) -> str: ...
def restart_service(service: str) -> bool: ...
def notify_sre(message: str) -> None: ...
## OpenAI Agent chooses which function to call at each step
## SDK manages loops, calls, decision-making
The agent is a hosted planner + function caller.
Summary by Control Model
| Framework | Control Owner | Memory | Best For |
|---|---|---|---|
| smolagents | Agent loop | App-managed | Programmatic automation |
| LangGraph | Workflow graph | Structured state | Multi-step validation logic |
| Microsoft | Platform | Built-in durable | Enterprise long-running processes |
| AutoGen | Conversation | Transcript-based | Multi-agent collaboration |
| CrewAI | Role delegation | Per-agent + shared | Organizational workflows |
| Auto-GPT | Autonomous agent | Vector + filesystem | Open-ended research |
| OpenAI SDK | Hosted orchestrator | Message context | LLM-native backends |