# Agentic Workflow

> The Agentic Workflow is a system where language models and tools are orchestrated through predefined steps.

## What is the difference between an agentic workflow and an agent?

The system where the steps are defined by code, such as routing, chaining or parallel calls, and models perform each step. More predictable than an autonomous agent and preferred when the path to the result is known in advance.

- Topic: AI Agents
- Type: concept

## Example

Wrong:

```js
const result = await runAgent({
  goal: 'Translate the article, summarize it and add tags',
  tools: allTools,
});
```

Right:

```js
const translated = await llm.generate({ prompt: translatePrompt(article) });
const summary = await llm.generate({ prompt: summaryPrompt(translated.text) });
const tagged = await llm.generate({ prompt: tagPrompt(summary.text) });
const tags = parseTags(tagged.text);
if (tags.length === 0) throw new Error('Tagging step failed');
```

The steps are known, so code fixes their order and the model only does each step, which is simpler to test.

## Common mistakes

- Building a free-form agent where a fixed sequence of steps would be simpler and safer.

## Key points

- Fixed steps are written in code, and the model only decides inside each step.
- Each step's output is validated before the next step runs.
- Failures in one step have a defined retry or fallback.

## Interview questions

### When should I use a workflow instead of an agent?

When the task always follows the same steps. Agents fit open-ended tasks where the next step depends on earlier results.

### What are common agentic workflow patterns?

Prompt chaining, routing to a specialized prompt, running steps in parallel, and an evaluator step that checks and refines output.

### Can a workflow include an agent?

Yes. A fixed workflow can call an agent for one open-ended step and keep the other steps deterministic.

## Related cards

- [AI Agent](https://wonderium.dev/ai/ai-agent.md)
- [Prompt Chaining](https://wonderium.dev/ai/prompt-chaining.md)
- [Multi-Agent System](https://wonderium.dev/ai/multi-agent-system.md)

---

- Level: [Artificial Intelligence](https://wonderium.dev/ai.md)
- HTML version: https://wonderium.dev/ai/agentic-workflow
- Last updated: 2026-11-25
