AI Agents
An AI agent is a workflow step that can reason about a goal, choose tools, inspect results, and decide what to do next. It is useful when the path to the answer is not always the same.
Do not use an agent just because a workflow uses AI. Use an agent when the workflow needs decision-making. For predictable transformations, a direct LLM chain is usually simpler and easier to test.
Agent loop
Section titled “Agent loop”Most agents follow the same loop:
flowchart TD
Goal["Goal + instructions"] --> Observe["Observe available data"]
Observe --> Decide["Decide next action"]
Decide --> Tool{"Need a tool?"}
Tool -->|Yes| Call["Call tool"]
Call --> Result["Read tool result"]
Result --> Decide
Tool -->|No| Answer["Return final answer"]
Decide --> Stop{"Limit reached or unsafe?"}
Stop -->|Yes| Fallback["Stop with partial result or error"]
style Decide fill:#e1f5fe,stroke:#0277bd
style Stop fill:#ffebee,stroke:#c62828
The loop is powerful, but it must be bounded. Give agents clear goals, tool access, stopping conditions, and output expectations.
Agent types in Agentic WorkFlow
Section titled “Agent types in Agentic WorkFlow”Use this when the model should transform known input into known output: summarize text, classify content, draft a message, or rewrite a field.
It is not really an agent loop. It is the best default for predictable AI steps.
Use this when the user asks a question about provided context. The quality depends on whether the workflow passes the right context into the node.
It is a good fit for page Q&A, document Q&A, and support-style answers.
Use this when the answer should be grounded in a vector store or local knowledge source.
It is the right choice when the model should search before answering.
Use this when the model must choose between tools, such as searching, extracting page content, querying Wikipedia, or calling a service.
It is the most flexible pattern, and also the one that needs the clearest limits.
When to use an agent
Section titled “When to use an agent”Use an agent when:
- The workflow does not know in advance which tool is needed.
- The task needs multiple steps and intermediate decisions.
- The model should inspect results before continuing.
- The workflow can tolerate some variability.
Avoid an agent when:
- The workflow is a fixed transformation.
- The output must follow a strict schema and no tool choice is needed.
- A wrong action would be expensive or destructive.
- The task can be solved with a direct node chain.
Agent design checklist
Section titled “Agent design checklist”| Design question | Why it matters |
|---|---|
| What is the exact goal? | Vague goals produce wandering tool calls |
| What data can the agent see? | Missing context leads to guesses |
| Which tools can it use? | Too many tools increase wrong choices |
| When should it stop? | Prevents loops and runaway execution |
| What should the output look like? | Makes downstream nodes reliable |
| How will you evaluate it? | Catches regressions and hallucinations |
Example: research workflow
Section titled “Example: research workflow”flowchart LR Trigger["User starts research"] --> Agent["Tools Agent"] Agent --> Text["Get page text"] Agent --> Wiki["Wikipedia Query"] Agent --> Http["Http Request"] Agent --> Final["Structured report"] style Agent fill:#e1f5fe,stroke:#0277bd
The agent should not be told “research this.” A stronger instruction is:
Find three source-backed facts about this company. Use page text first, then Wikipedia if the page lacks enough context. Return a short report with source URLs.
That instruction gives the agent a goal, tool preference, stopping condition, and output shape.