Step 08 of 22
Orchestration & agents
Chain model calls, tools and state into workflows and agents. Frameworks handle retries, state, tool calls and hand-offs. The wrong one adds abstraction you will fight later.
How to choose
- Simple RAG or one tool call: plain SDK code may be all you need.
- Long-running, stateful agents with human approval: a graph-based framework.
- Visual building for non-developers: a low-code platform.
What to look for
The questions that separate the options, in order of how much they matter.
01
Language and team fit
Most frameworks are Python-first; TypeScript teams should look at Mastra, or at the TypeScript ports of LangGraph, the OpenAI Agents SDK and Google ADK, and check that the port has feature parity. .NET shops have one serious option in Microsoft Agent Framework. A framework your team can read and debug beats a more capable one nobody understands.
02
Abstraction level: graph, agent loop or canvas
Graph or state-machine frameworks (LangGraph, Microsoft Agent Framework workflows, ADK 2.0, LlamaIndex Workflows) make every step and branch explicit, which suits regulated or long-running processes. Agent-loop SDKs (OpenAI Agents SDK, Pydantic AI, smolagents, Agno) let the model choose the next tool, which is faster to build and harder to predict. Low-code canvases (Dify, n8n) let non-developers build flows but are awkward to test, review and version like code. Many teams start with a loop and move hot paths to a graph.
03
State and durable execution
An agent that runs for minutes or days must survive a crash or deploy without starting over. Look for checkpointing to a real database (LangGraph checkpointers, Microsoft's checkpoint storage, CrewAI's @persist, ADK's DatabaseSessionService) or integration with a durable engine such as Temporal or DBOS, as Pydantic AI offers. Check that tools are safe to re-run, because resume usually guarantees at-least-once, not exactly-once, execution.
04
Human-in-the-loop that can wait
Approvals before risky tool calls (sending money, deleting data, emailing customers) should be first-class: the run pauses, a person approves or edits, and the run resumes, possibly hours later on another server. Most frameworks now offer this, but it only survives restarts when combined with durable state. Test the pause-resume path early; it is where bugs cluster.
05
Observability and evals
You will spend more time reading traces than writing prompts. Prefer frameworks that emit OpenTelemetry or plug into tracing tools such as Langfuse, Phoenix or LangSmith, rather than only a vendor dashboard. Built-in tracing (on by default in the OpenAI Agents SDK, Logfire for Pydantic AI, Mastra's tracing and evals) is a real time-saver, as long as you can export the data.
06
Multi-agent only when one agent fails
Role-based crews and handoffs make good demos but multiply token use and make failures harder to trace, a complaint reviewers raise about CrewAI in particular. Start with one agent and good tools; split into several when tasks genuinely need separate context or permissions. If you do, prefer explicit handoffs or graph edges over free-form agent chat.
07
Licence, vendor pull and release pace
Most code frameworks are MIT or Apache 2.0, but check open-core boundaries (Mastra's ee/ folder) and fair-code or modified licences on platforms (n8n's Sustainable Use License, Dify's added conditions for multi-tenant hosting). Vendor SDKs work best with their own models and clouds. Check the release history: a framework without releases for months, as smolagents had in 2026, will lag on new model features.
How the options differ
Three families compete. Code-first graph frameworks (LangGraph, Microsoft Agent Framework, Google ADK 2.0, LlamaIndex Workflows) give you explicit control over each step, state and pause point, at the cost of more code. Lightweight agent SDKs (OpenAI Agents SDK, Pydantic AI, CrewAI, Agno, smolagents, Mastra) wrap the model-calls-tools loop with handoffs, memory and tracing and get a working agent running fastest; most have since added workflow layers for predictable paths.
Low-code platforms (Dify, n8n) put agents on a visual canvas with hosted runtimes and hundreds of integrations. They suit operations teams and internal automation, but their licences restrict reselling as a service and their flows are harder to test and review than code.
12 tools, compared
Ranked by our rating. Open any review for sources, prices and the full verdict.
| Tool | Rating | Our verdict | Best for | Price |
|---|---|---|---|---|
| LangGraphrepo | 4.6/5 | Explicit control over every step an agent takes, paid for in code and learning time, and worth it once an agent must survive restarts and wait for a human. | Engineering teams building long-running or multi-step agents that must be reliable and auditable. | Free and open source under the MIT licence. LangSmith (tracing and deployment) is separate: Developer free for one seat, Plus $39/seat/month plus compute, Enterprise custom. |
| Pydantic AIrepo | 4.5/5 | Pydantic AI brings the discipline of typed Python to agents, at the cost of a release train you have to pin. | Python engineers building production agents who want strong typing, testability and freedom to switch models. | Free and open source under the MIT licence. Logfire observability: Personal free up to 10M records/month, Team $49/month plus $2 per extra million records. Pydantic AI Gateway adds a 5% markup on built-in providers. |
| Difyrepo | 4.5/5 | Dify gives business teams a complete LLM app builder they can edit themselves, on a licence that only bites when you resell it as a hosted service. | Teams building internal chatbots and RAG apps that non-engineers will maintain. | Self-hosted Community Edition free (modified Apache 2.0, one workspace). Dify Cloud: Sandbox free (200 one-time message credits), Professional $590/workspace/year, Team $1,590/workspace/year (annual billing, which Dify says saves 17%), Enterprise by quote. |
| OpenAI Agents SDKrepo | 4.4/5 | A small, readable agent SDK whose defaults quietly assume OpenAI: tracing ships your runs to its dashboard, and the local sandbox trusts your machine. | Developers building agents mainly on OpenAI models who want a minimal, well-documented SDK. | Free and open source under the MIT license. You pay for model usage. |
| Mastrarepo | 4.4/5 | TypeScript's most complete agent toolkit, released at a pace that rewards teams who pin versions and read changelogs. | TypeScript and Next.js teams building agents and AI workflows. | Core is free under Apache 2.0; code in ee/ folders needs a Mastra Enterprise licence in production. Mastra's hosted platform: Starter $0, Teams $250/month, Enterprise custom; self-hosted Enterprise is a flat annual fee. |
| n8nrepo | 4.4/5 | Wide reach for wiring AI steps into business systems at a flat self-hosted cost, offset by a security patch cadence no self-hoster can ignore. | Ops and engineering teams automating business processes that include AI steps. | Fair-code: Community Edition free to self-host under the Sustainable Use License. Billed annually: Cloud Starter €20/month (2,500 executions), Pro €50/month (10,000); self-hosted Business €667/month (40,000); Enterprise custom. |
| LlamaIndexrepo | 4.3/5 | Still a deep toolkit for document-heavy RAG, but its maker now says plainly that the framework is no longer its priority. | Python developers building RAG or document agents over large, varied data sources. | Framework free under MIT. LlamaParse (paid cloud): Free with 10k credits, Starter $50/month (40k credits), Pro $500/month (400k credits), Enterprise custom; 1,000 credits = $1.25. |
| Google Agent Development Kit (ADK)repo | 4.2/5 | A serious, fast-moving agent framework whose shortest road always leads to Gemini and Google Cloud, which is either the point or the catch. | Teams building agents on Gemini or deploying to Google Cloud. | Free and open source under the Apache 2.0 licence. You pay for the models and Google Cloud services you use. |
| Microsoft Agent Frameworkrepo | 4.2/5 | The obvious home for .NET and Azure teams building agents, and a capable but less proven choice for Python teams elsewhere. | .NET and Azure teams, and anyone migrating from AutoGen or Semantic Kernel. | Free and open source under the MIT licence. You pay only for the models and Azure services you use. |
| CrewAIrepo | 4.1/5 | Fast to a working multi-agent demo and harder to steer the further it travels from one, so production teams end up writing Flows rather than Crews. | Python developers who want a multi-agent workflow running quickly and can accept less low-level control. | Free and open source under the MIT licence. CrewAI AMP: Basic free with 50 workflow executions a month; Enterprise (more executions, SSO, RBAC, VPC or on-prem deployment) by quote. |
| Agnorepo | 4.1/5 | Agno turns a Python agent into a served API with very little glue, but that API ships with authentication switched off. | Python teams that want to run production agents on their own infrastructure with minimal plumbing. | Framework and AgentOS free under Apache 2.0. Control plane: free against a local AgentOS; Pro $150/month (one live connection, three seats, extra seats $30, SAML SSO $300); Enterprise custom. |
| smolagentsrepo | 3.5/5 | A clear demonstration that agents can act in code, now drifting into maintenance mode with 590 pull requests waiting. | Researchers and learners exploring code-writing agents, especially with open models. | Free and open source under the Apache 2.0 license. |
Side by side
The specifications that matter for this step. Checked 2026-10-19; confirm on the vendor’s site before you commit.
| Tool | Language | Abstraction | State / durability | Human-in-the-loop | Multi-agent | Licence |
|---|---|---|---|---|---|---|
| LangGraph | Python; separate JS/TS library | Graph / state machine | Checkpoints every step | First-class interrupts | Yes, as graph nodes | MIT |
| Pydantic AI | Python | Typed agent loop | Temporal, DBOS, Prefect | Yes (tool approval) | Fewer prebuilt patterns | MIT |
| Dify | Low-code (Python backend) | Visual canvas | Paused runs via workers | Yes (Human Input node) | Via workflows | Modified Apache 2.0 |
| OpenAI Agents SDK | Python; separate TS repo | Agent loop with handoffs | Sessions; durable approvals | Yes (approvals) | Yes, handoffs | MIT |
| Mastra | TypeScript | Agents plus typed workflows | Memory; suspend and resume | Yes (workflow suspend) | Yes, supervisor agents | Apache 2.0 (ee/ commercial) |
| n8n | Low-code (TS backend) | Visual workflow automation | Stored executions | Yes (tool-call review) | Via sub-workflows | Sustainable Use (fair-code) |
| LlamaIndex | Python, TypeScript | Event-driven workflows | Serialisable context | Yes (input events) | Yes (AgentWorkflow) | MIT |
| Google Agent Development Kit (ADK) | Python, TS, Go, Java | Agents plus graph (2.0) | Database sessions; resume | Yes (tool confirmation) | Yes | Apache 2.0 |
| Microsoft Agent Framework | Python, .NET | Agents plus graph workflows | Checkpoint storage | Yes (request/response) | Yes | MIT |
| CrewAI | Python | Role crews plus Flows | @persist (SQLite default) | Yes (@human_feedback) | Yes, core design | MIT |
| Agno | Python | Agent loop plus AgentOS | Sessions in your database | Yes (approval pauses) | Yes, teams | Apache 2.0 |
| smolagents | Python | Code-writing agent loop | In-process memory only | Via step callbacks | Yes (managed agents) | Apache 2.0 |
Where this stage fits
- Chat with your documents: we would start with LlamaIndex.
- Customer support agent: we would start with LangGraph.
- Research & knowledge graph: we would start with LlamaIndex.
- Assistant with long-term memory: we would start with OpenAI Agents SDK.
- Voice agent: we would start with Pydantic AI.
- Document processing: we would start with n8n.
- Workflow automation: we would start with n8n.
Sources for this guide
- LangGraph.js repository
- Pydantic AI: deferred tools and approval
- CrewAI docs: Flows
- Google ADK: action confirmations
- Google ADK: resume stopped agents
- Microsoft Agent Framework: human-in-the-loop workflows
- LlamaIndex: human in the loop
- smolagents: human-in-the-loop plan customisation
- Dify: the Human Input node
- n8n docs: human-in-the-loop for tools
- smolagents: orchestrate a multi-agent system
- Mastra: multi-agent systems