Workflow vs Agent

A tool-using assistant and an agent may use exactly the same model and exactly the same tools.

The difference is who chooses the order of work.

Intuition

The only difference that matters

In a workflow, the developer chooses the sequence while writing the application:

retrieve_policy()
search_flights()
search_hotels()
rank_and_return()

The model may fill in arguments, summarise results, or write the final response. It does not decide what step comes next.

In an agent, the model chooses the next action during the run:

goal + tools
    ↓
decide
    ↓
act and observe
    ↓
decide again

Side-by-side control flow

flowchart TB subgraph W["Workflow: developer chooses"] W1[Retrieve policy] --> W2[Search flights] W2 --> W3[Search hotels] W3 --> W4[Check and return] end subgraph A["Agent: model chooses"] A1[Goal and available tools] --> A2[Choose next action] A2 --> A3[Run tool] A3 --> A4[Observe result] A4 --> A5{Goal reached?} A5 -->|No| A2 A5 -->|Yes| A6[Return result] end
Question Workflow Agent
Who decides the order? Developer at build time Model at runtime
Are steps predictable? Yes Not always
Can it loop after a surprise? Only if the loop was coded Yes, within allowed tools and budgets
Cost and latency Easier to bound exactly Varies by number of steps
Audit path Stable and repeatable Requires detailed traces
Main risk Cannot handle an unplanned branch Can choose an unnecessary or harmful action

Use a workflow when

Example: monthly expense-report generation. Import the file, validate rows, total expenses, create the report, and send it for approval. The order does not need a model.

Use an agent when

Example: planning the Paris trip. A failed booking-window check means the agent must decide whether to change dates, choose a different itinerary, or ask the user.

Most real systems use both

You do not have to choose an entirely deterministic application or an entirely autonomous agent.

A safer design is often:

flowchart LR V[Validate request
fixed code] --> A[Choose a recovery plan
agent] A --> P[Ask for approval
fixed checkpoint] P --> E[Execute booking
fixed code]

Use deterministic code for the parts you can name in advance. Add an agent only where the path is genuinely unknown.

Why this hybrid design is safer

A practical decision test

Before building, answer these questions:

  1. Can I list every step now?
  2. Is the order always the same?
  3. Can ordinary if statements handle all expected failures?
  4. Would an extra tool call create cost or risk?
  5. Does the next step truly depend on unstructured results?

If the first four answers point to predictability, start with a workflow. If the fifth is the heart of the task, an agent may be justified.

What goes wrong

One-line summary

A workflow follows the developer's fixed route; an agent chooses the next step from runtime observations, and practical systems often combine both.

Key terms