Skip to content
ConsultEvo

AI Agent Frameworks: How to Choose by Workflow Control

Choose an AI agent framework by deciding who should control the next step. If the task follows known rules, use ordinary code or a deterministic pipeline. Use a graph workflow when it must branch, preserve state, pause for approval, or resume later. Use an agent runtime when the system must choose among a bounded set of tools. Add multiple agents only when distinct responsibilities genuinely require delegation.

A support ticket that needs one classification and one predictable queue update may need only a model call inside fixed application code. If a consequential update must wait for a manager and resume days later, a stateful graph may fit better. The right choice depends on the control requirement, not on a universal framework ranking.

Choose the least complex control model that satisfies verified workflow requirements; a longer feature list is not a reason to add autonomy.

What an AI agent framework manages

An AI agent framework is reusable software for building and operating agent behavior. Depending on the project, it may provide tool execution, orchestration, session or workflow state, structured outputs, approval pauses, and tracing. It does not supply your business rules, credentials, data ownership, or a complete production application.

A direct model call returns an answer. An agent workflow can select an allowed tool or action, receive its result, and continue under defined control. That difference does not make every model task an agent task. If the flow is user text, one classification call, schema validation, and one fixed API action, ordinary application code may be simpler and easier to govern.

Memory also needs a precise definition. Session history is conversation context. Persisted workflow state supports pause and resume. Longer-term application data may be a customer profile, document store, or knowledge base. These have different owners, retention rules, and access controls. LangGraph documents checkpointers for thread state and stores for longer-term data, but the application still configures and manages persistence (LangGraph persistence concepts).

Compare frameworks by execution model

Capabilities overlap, so the profiles below describe documented capabilities and plausible starting scenarios rather than rankings. Confirm the language, model provider, version, license, and exact feature you need before choosing.

Stateful graphs and explicit workflows

  • LangGraph: A candidate for workflows with branching, durable state, interruptions, and resumption. Its checkpointer and interrupt documentation supports pause-and-resume patterns. The application must still provide persistence configuration, an approval interface, authorization, and resume handling (LangGraph human-in-the-loop documentation).
  • Microsoft Agent Framework: Microsoft documents it as the direct successor to AutoGen and Semantic Kernel. Its overview distinguishes open-ended agents from workflows with explicit execution order and says an ordinary function should be preferred when it is sufficient. Consider it when your team needs those abstractions and documented integrations. Feature availability varies by language and provider, and teams remain responsible for permissions, data handling, testing, and safety mitigations (Microsoft Agent Framework overview).
  • Google ADK: A candidate for teams building graph-based workflows with documented human input, retries, timeouts, evaluation, observability, and deployment options. Its documentation lists Python, TypeScript, Go, Java, and Kotlin entry points. Google Cloud integration is available, but ADK is not limited to Google models or Google Cloud deployment. Check the exact language version and provider support you intend to use (Google ADK graph workflows).

Tool-using runtimes and role-based collaboration

  • OpenAI Agents SDK: Documents tools, structured outputs, sessions, guardrails, tracing, human-in-the-loop mechanisms, and agent orchestration. In manager-style orchestration, a manager retains control while calling specialists as tools. A handoff transfers control to another agent. It is a candidate for bounded tool use or specialist delegation, while the application still owns external state, credentials, authorization, and data governance (OpenAI Agents SDK agents and orchestration).
  • CrewAI: Its current documentation covers agents, tasks, crews, flows, memory, checkpointing, testing, and human-in-the-loop workflows. It may suit work that is naturally expressed as role- and task-oriented collaboration. Define responsibilities and state explicitly because a role metaphor does not itself make a workflow easier to control (CrewAI documentation).

Data-oriented, pipeline, and typed Python options

  • LlamaIndex: Combines data and retrieval capabilities with documented agents, tools, state, structured output, human review, and multi-agent patterns. Consider it for document- or knowledge-heavy work that also needs agent behavior. It is not limited to retrieval-augmented generation (LlamaIndex agents).
  • Haystack: Documents directed multigraph pipelines with branches, loops, parallel execution, deterministic components, and agents. It suits pipeline-oriented systems that combine fixed processing with a bounded agent step. Its current documentation also supports broader agent composition, so it should not be reduced to search alone (Haystack pipelines and Haystack agents).
  • PydanticAI: A candidate when Python type modeling, structured outputs, and provider options matter. Its model documentation lists multiple providers, but portability does not ensure identical schemas, tool behavior, or model capabilities. Test the exact provider and features required (PydanticAI model providers).

TypeScript-native application framework

  • Mastra: A TypeScript-native option with documented agents, workflows, memory, deployment, traces, metrics, and evaluations. It may suit a TypeScript application team that wants those capabilities in its development environment. Its repository documents a mixed licensing model, so check the relevant license boundaries rather than assuming every component has the same terms (Mastra documentation and Mastra repository and licensing).

For every project, check current release status, licensing, hosting, provider charges, managed-service costs, and feature availability. Documentation demonstrates a capability. It does not establish that the capability is enabled by default or sufficient for production governance.

A selection method you can apply to your workflow

Before comparing packages, write down the workflow as an operational process. Identify the trigger, data entering the system, decisions, actions, system of record, validation gates, and person responsible when an exception occurs.

01Map the workRecord the trigger, inputs, fixed rules, possible branches, external actions, system of record, and exception owner. Mark which decisions are deterministic and which require language interpretation.
02Choose the control boundaryUse code or a pipeline for a fixed sequence. Use an explicit loop for bounded retries. Use a graph for stateful branches or approval. Use an agent for bounded tool selection. Use delegation only when responsibilities are genuinely distinct.
03Verify required capabilitiesCheck the exact language, provider, state persistence, approval, tracing, and deployment features in current documentation. Do not infer feature parity from a framework’s headline provider list.
04Name the operational ownersSpecify who manages credentials, data retention, approvals, retries, upgrades, failed writes, and incidents. If nobody owns these tasks, simplify the design before prototyping.

Use this hypothetical comparison to make the control boundary concrete:

Trigger AI responsibility Validation Destination or fallback
Support ticket arrives Choose a label from a fixed issue-type list Reject unknown labels; check ticket status and routing policy Update the queue, or send ambiguity to support operations
New invoice version arrives Extract specified fields with evidence spans Check types, required fields, consistency, and source version Save a proposal for review, then commit to the finance system
Consequential update is requested Prepare a bounded recommendation Recheck record version, permitted action, and reviewer authority Pause for approval, resume to write, or escalate on timeout

These are proposed designs, not vendor templates. The framework supplies orchestration primitives; your application defines the business records, policies, approval experience, and destination behavior.

Build validation and safe writes around the model

Use deterministic code for identity resolution, duplicate detection, permissions, calculations, thresholds, required fields, and record-version checks. Use the model for ambiguous language, extraction, summarization, or choosing among explicitly allowed actions. A syntactically valid response is not necessarily a valid business decision.

For any external write, resolve the destination record, confirm it is current, check field eligibility, validate type and business rules, compare the proposed value with the existing value, and require approval when the impact warrants it. Keep proposed extraction separate from the committed business record until those checks pass. Assign a system of record and a named exception owner. For CRM write controls, see CRM systems consulting.

For a hypothetical ticket-classification step, the model might return:

{
  "issue_type": "billing",
  "rationale": "The message asks for help with an invoice.",
  "evidence_spans": [
    "help with an invoice"
  ]
}

The application should reject any label outside its allowed enum, resolve the ticket and account using stable IDs, check current status and routing policy, and update the queue only if this source event has not already been processed. An ambiguous label or account-status conflict goes to a support operations queue, not to an improvised model action.

A useful illustrative run contract keeps the proposal, provenance, approval, and write operation distinct:

{
  "source_event_id": "ticket-event-illustrative-1842",
  "run_id": "run-illustrative-07",
  "workflow_version": "ticket-routing-v1",
  "prompt_version": "classify-v3",
  "extracted_value": "billing",
  "evidence_spans": [
    "help with an invoice"
  ],
  "validation_status": "passed",
  "proposed_action": "set_queue",
  "approval_status": "not_required",
  "destination_record_id": "ticket-illustrative-721",
  "write_operation_id": "write-illustrative-03"
}

This is a proposed application contract, not a vendor schema. The source-event record identifies the inbound event. The run record identifies one execution attempt. A tool-call record identifies each invocation within that run. A write-operation record identifies the external mutation. Enforce uniqueness at the correct grain with a database constraint, transactional upsert, queue deduplication, or a supported destination idempotency key. A search followed by create is not safe against concurrent workers.

Data-grain decision

A ticket ID identifies the business record, not every processing attempt. Give the source event, each run, each tool call, and each write operation their own stable identities. If a document contains several extracted fields, preserve field-level evidence rather than collapsing every observation into one document-level result.

For a document, preserve field-level evidence where practical, such as the source URI, content hash, document version, and span supporting an extracted value. Missing or conflicting critical fields should go to a reviewer; a confidence score alone should not authorize a financial or identity-related change. For an approval-based workflow, persist state before pausing, record reviewer identity and decision, verify that the destination record has not changed, and set an escalation path for unanswered requests.

Check integrations and operational fit

A framework’s orchestration is separate from access to a business application. Before enabling a write, verify the exact action and fields in the target account, authorization scope, whether the action creates or updates, pagination and rate limits, retry behavior, duplicate controls, PII handling, and the human fallback.

Zapier offers separate entry points: MCP for supported AI clients, an SDK for code-oriented use, and a CLI for terminal workflows. They are not interchangeable framework features. Zapier’s current MCP product page advertises more than 9,000 apps and 66,000 triggers and actions, along with managed authentication and controlled permissions. Treat those as Zapier product claims and confirm the specific action, account availability, permission scope, write behavior, and audit requirements for your use case. Catalog size does not establish identical capabilities across apps.

Tracing can help inspect model and tool behavior, but prompts, outputs, and tool arguments may contain sensitive information. The OpenAI Agents SDK documents tracing controls, including controls for sensitive data. Decide what may be retained, who can inspect it, and how long it is kept before enabling production tracing (OpenAI Agents SDK tracing configuration).

Teams evaluating an implementation can review AI agent implementation services when they need help defining workflow ownership and controls.

When not to use an agent framework

Prefer a function, direct model call, or fixed pipeline when the task has one predictable step, no tool choice, and no need for durable state or orchestration. Do not introduce multiple agents when one bounded agent or ordinary code can do the work. Delegation adds state, ownership, and failure paths. If no team owns credentials, testing, upgrades, and exceptions, start with a simpler design.

Microsoft’s guidance to prefer an ordinary function when it is sufficient aligns with Haystack’s documented distinction between fixed pipelines and agent-led execution (Haystack pipeline and agent decision guide). Stop at a stable function or fixed pipeline when it meets the need. Adding autonomous tool selection only to call a workflow an agent makes control harder without solving a demonstrated requirement.

A concise decision checklist

  • Can you name the trigger, inputs, allowed decisions, output, system of record, and exception owner?
  • Is the control need explicit: fixed sequence, bounded loop, stateful branch, tool choice, or specialist delegation?
  • Have you verified the required language, provider, deployment, and integration features in current documentation?
  • Are parsing, allowed-value checks, business validation, approvals, and safe retry behavior defined before external writes?
  • Can the team inspect failures without retaining data it should not store?
Ready for a design review
  • The control model and required framework capabilities are documented.
  • Every external write has a validation gate and a duplicate-safe retry path.
  • A person owns approvals, exceptions, and operational incidents.
  • State, credentials, and trace-data retention have named owners.
  • The team can explain what happens when a tool fails or the record changes before a write.

The practical choice is the simplest control model that satisfies verified workflow requirements. Start with the work and its owners, then select the framework that supports the necessary execution pattern.