> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scoutos.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent Blocks: Run Agents as Workflow Steps

> Embed Scout agents as steps inside a workflow. Use Agent Blocks to process unstructured data, route intelligently, generate content, and enrich records — then pass the results to downstream blocks.

Agent Blocks are the bridge between [Agents](/agents/overview) and [Workflows](/workflows/overview). A workflow gives you reliable, repeatable structure — triggers, branching, and integrations that run the same way every time. An agent gives you judgment — the ability to read messy input, reason about it, and decide what to do. An Agent Block lets you drop that judgment into any step of a workflow, so the structured parts stay deterministic while the hard parts get handled by an AI agent.

<Note>
  Agent Blocks run an agent you've already built in Scout. If you don't have one yet, start with [Getting Started with Agents](/agents/getting-started) and come back once you have an agent to embed.
</Note>

## When to Use an Agent Block

Reach for an Agent Block whenever a step needs to interpret something rather than follow a fixed rule.

**Processing unstructured data.** Pull intent, urgency, and key details out of an incoming email, support ticket, or document — text that has no fixed schema and can't be parsed with a condition.

**Intelligent routing.** Categorize tickets, score and qualify leads, or tag feedback so downstream blocks can branch on the result.

**Content generation.** Draft a follow-up email, summarize a meeting, or produce a report from the data the workflow has gathered so far.

**Research and enrichment.** Research a company, surface recent news, or assemble context about a contact before the workflow records or acts on it.

<Tip>
  If a step is purely deterministic — "route to engineering when `priority == 1`" — use a [Condition Block](/workflows/blocks) instead. Agent Blocks are for the steps that genuinely need language understanding or judgment.
</Tip>

## How Agent Blocks Work

### Adding a block

<Steps>
  <Step title="Open the workflow builder">
    Open the workflow where you want to add AI judgment, and click the **+** to add a new block.
  </Step>

  <Step title="Select Agent Block">
    Choose **Agent Block** from the block picker, then select which of your agents should run at this step.
  </Step>

  <Step title="Write the prompt and map inputs">
    Give the agent its instructions for this step and map in the inputs it needs (see below).
  </Step>

  <Step title="Set the output format">
    Choose how the agent should return its result — plain text, JSON, or structured data — based on what downstream blocks expect.
  </Step>
</Steps>

### Configuring inputs

An Agent Block can draw its inputs from three sources:

* **The workflow trigger** — data from the event that started the run, e.g. `{{ trigger.ticket_body }}`
* **Previous blocks** — output from any block earlier in the workflow
* **Static values** — fixed text or configuration you type directly

You reference dynamic inputs with Jinja template syntax. For example, to pass the body of an incoming ticket into the agent:

```text theme={null}
{{ trigger.ticket_body }}
```

<Tip>
  Keep inputs small and explicit. Pass only the fields the agent needs to make its decision — not the entire workflow state. Focused inputs produce more reliable results and make the workflow easier to debug.
</Tip>

### Handling output

The agent's response is available to downstream blocks as `agent_result`, referenced through the block's name. If an Agent Block named `analyze_ticket` returns a structured result, later blocks can read individual fields:

```text theme={null}
{{ blocks.analyze_ticket.agent_result.category }}
{{ blocks.analyze_ticket.agent_result.urgency }}
{{ blocks.analyze_ticket.agent_result.suggested_action }}
```

When an agent returns JSON, parse it with a JSON block before referencing individual fields downstream. That guarantees later blocks receive clean, structured data instead of a raw string.

## Example: Meeting Follow-up Workflow

This workflow turns a raw meeting transcript into tracked tasks and a drafted follow-up email — without anyone reviewing the transcript by hand.

<Steps>
  <Step title="Webhook trigger">
    A webhook receives the meeting transcript when the call ends.
  </Step>

  <Step title="Agent Block — extract action items">
    An agent reads the transcript and extracts action items, decisions, and follow-ups, assigning an owner and deadline to each.
  </Step>

  <Step title="Action Block — create tasks">
    An Action Block creates a task in your project tool for each action item the agent returned.
  </Step>

  <Step title="Agent Block — draft the email">
    A second agent drafts a follow-up email summarizing the decisions and next steps.
  </Step>

  <Step title="Action Block — send the email">
    An Action Block sends the draft through Gmail to the meeting attendees.
  </Step>
</Steps>

The workflow runs the same way every time, while the agents absorb the nuance of each individual meeting — different attendees, different decisions, different follow-ups.

## Example: Lead Intelligence Workflow

This workflow enriches a new lead, records it, and routes it based on its value — combining research, a CRM write, content generation, and branching in a single run.

<Steps>
  <Step title="Webhook trigger">
    A webhook fires when a new lead submits a form.
  </Step>

  <Step title="Agent Block — research the company">
    An agent researches the lead's company and assembles context: size, industry, recent news, and a lead score.
  </Step>

  <Step title="Action Block — create the CRM record">
    An Action Block creates a CRM record populated with the enriched data.
  </Step>

  <Step title="Agent Block — generate outreach">
    An agent generates a personalized outreach email tailored to the company and its context.
  </Step>

  <Step title="Condition Block — route by lead score">
    A Condition Block checks the lead score: high-value leads notify a sales rep immediately, while the rest enter a nurture sequence.
  </Step>
</Steps>

## Best Practices

**Keep agents focused.** One task per block. Chain several focused Agent Blocks rather than asking a single agent to do everything — focused agents are more accurate and far easier to debug when something goes wrong.

**Define clear outputs.** Tell the agent exactly what format to return, ideally JSON with named fields like `category`, `urgency`, `summary`, and `suggested_action`. Predictable output is what makes downstream blocks reliable.

**Handle edge cases.** Add a Condition Block after the agent to catch invalid or low-confidence output and route it to a human review queue instead of letting the workflow act on a bad result.

**Use instructions as configuration.** Be specific in the prompt about the inputs, the required output format, and any constraints. The prompt is how you tune an Agent Block's behavior for its place in the workflow.

## Limitations

* **Agent Blocks run synchronously by default.** The workflow waits for the agent to finish before moving to the next block.
* **Split long tasks.** Complex work that takes more than a few seconds should be broken across multiple blocks, or handled with [async interactions](/agents/getting-started) so the workflow isn't blocked.
* **Use Condition Blocks for deterministic logic.** If a decision doesn't require judgment, a Condition Block is faster and more predictable than an agent.

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Workflows Overview" icon="diagram-project" href="/workflows/overview">
    See how triggers, blocks, and branching fit together.
  </Card>

  <Card title="Workflow Blocks" icon="cubes" href="/workflows/blocks">
    Explore every block type you can combine with Agent Blocks.
  </Card>

  <Card title="Agents Overview" icon="robot" href="/agents/overview">
    Build and configure the agents you embed in workflows.
  </Card>

  <Card title="Delegation" icon="sitemap" href="/agents/delegation">
    Coordinate multiple agents on a single complex task.
  </Card>
</CardGroup>
