Agents

5 concepts · 10 practice questions

Agents and workflows

A workflow is a fixed sequence of model calls that your code controls: classify, then retrieve, then answer. An agent is a model in a loop that decides its own next step and which tool to call until the task is done. Workflows are cheaper, faster and easier to test, so use one when the steps are known in advance. Reach for an agent when the path cannot be predicted, and accept that it costs more and varies between runs.

# Workflow: code decides the path.
label = classify(ticket)
docs = retrieve(ticket, category=label)
reply = draft(ticket, docs)

# Agent: the model decides the path.
reply = agent_loop(task=ticket, tools=[search, get_order, refund],
                   max_steps=12)

Also covered

Planning and decomposition
Context management in long runs
Orchestrators and sub-agents
Budgets, recovery and handoff

Sign in to read the rest and take the 10-question test.

Sign in to continue