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

# Agents in Flows

> Combining agents with flows for powerful automation

Combine the reasoning capabilities of agents with the structured automation of flows.

## Agent as Flow Node

Use agents within flows for intelligent processing:

```mermaid theme={null}
graph LR
    A[Flow Input] --> B[Data Prep]
    B --> C[Agent Node]
    C --> D[Process Result]
    D --> E[Flow Output]
```

**Use Cases:**

* Add reasoning to structured workflows
* Dynamic decision making within flows
* Context-aware processing
* Multi-step analysis

**Example:**

```
Customer Request
  → Extract Data
  → Agent (analyze request, determine best solution)
  → Execute Solution Flow
  → Send Response
```

***

## Common Patterns

### Agent-Driven Workflow Selection

Agent chooses which workflow to execute:

```mermaid theme={null}
graph LR
    A[User Request] --> B[Agent Analyze]
    B --> C{Best Flow?}
    C -->|Flow A| D[Execute Flow A]
    C -->|Flow B| E[Execute Flow B]
    C -->|Flow C| F[Execute Flow C]
    D --> G[Return Result]
    E --> G
    F --> G
```

**Use Case:** Intelligent routing based on request analysis

**Configuration:**

* Agent has access to multiple flows as tools
* Instructions guide flow selection
* Agent explains reasoning
* Results returned to user

### Multi-Agent Orchestration

Coordinate multiple specialized agents:

```mermaid theme={null}
graph LR
    A[Complex Task] --> B[Coordinator Agent]
    B --> C[Research Agent]
    B --> D[Data Agent]
    B --> E[Writer Agent]
    C --> F[Coordinator Synthesize]
    D --> F
    E --> F
    F --> G[Final Output]
```

**Use Case:** Break complex tasks into specialized subtasks

**Configuration:**

* Main orchestrator agent with delegation tools
* Specialized agents for specific domains
* Result aggregation logic
* Quality control steps

### Agent with Human Review

Agent proposes action, human approves:

```mermaid theme={null}
graph LR
    A[Request] --> B[Agent Analyze]
    B --> C[Propose Solution]
    C --> D[Human Review]
    D --> E{Approved?}
    E -->|Yes| F[Execute]
    E -->|No| G[Revise]
    G --> B
```

**Use Case:** High-stakes decisions requiring human approval

**Configuration:**

* Agent generates proposal
* Human-in-the-loop node
* Approval workflow
* Revision loop

### Iterative Refinement

Agent iterates until quality threshold met:

```mermaid theme={null}
graph LR
    A[Requirements] --> B[Agent Generate]
    B --> C[Quality Check]
    C --> D{Quality OK?}
    D -->|No| E[Feedback]
    E --> B
    D -->|Yes| F[Accept]
```

**Use Case:** Content generation with quality control

**Configuration:**

* Quality evaluation criteria
* Maximum iterations
* Feedback generation
* Acceptance threshold

***

## Flow Provides Tools to Agent

Flows as tools that agents can execute:

### Pattern: Agent Orchestrator

```mermaid theme={null}
graph TB
    A[User Request] --> B[Agent]
    B --> C{Action Needed?}
    C -->|Get Data| D[Execute Data Flow]
    C -->|Process| E[Execute Process Flow]
    C -->|Notify| F[Execute Notification Flow]
    D --> B
    E --> B
    F --> B
    B --> G[Final Response]
```

**Use Case:** Agent uses flows as tools to accomplish tasks

**Configuration:**

* Agent instructions mention available flows
* Flows configured as agent tools
* Agent decides when to use each flow
* Results integrated into conversation

### Pattern: Agentic Workflow

```mermaid theme={null}
graph LR
    A[Start] --> B[Agent Plan]
    B --> C[Execute Step 1 Flow]
    C --> D[Agent Evaluate]
    D --> E[Execute Step 2 Flow]
    E --> F[Agent Finalize]
```

**Use Case:** Agent plans and executes multi-step workflow

**Configuration:**

* Agent has planning instructions
* Multiple flows available as tools
* Agent evaluates results between steps
* Adaptive execution based on outcomes

***

## Advanced Scenarios

### Research and Report Generation

```mermaid theme={null}
graph TB
    A[Topic] --> B[Research Agent]
    B --> C[Web Research]
    B --> D[KB Search]
    C --> E[Synthesize]
    D --> E
    E --> F[Writer Agent]
    F --> G[Generate Report]
    G --> H[Format Document]
```

**Use Case:** Comprehensive research reports with multiple sources

### Customer Support Automation

```mermaid theme={null}
graph TB
    A[Customer Message] --> B[Agent Analyze]
    B --> C{Can Resolve?}
    C -->|Yes| D[KB Search]
    D --> E[Generate Solution]
    E --> F[Send Response]
    C -->|No| G[Create Ticket]
    G --> H[Assign to Human]
```

**Use Case:** Automated first-line support with escalation

### Data Processing Pipeline

```mermaid theme={null}
graph LR
    A[Raw Data] --> B[Agent Analyze]
    B --> C[Clean Data Flow]
    C --> D[Agent Validate]
    D --> E{Valid?}
    E -->|Yes| F[Process Flow]
    E -->|No| G[Flag Issues]
    F --> H[Agent Summarize]
```

**Use Case:** Intelligent data processing with validation

***

## Best Practices

**Agent-Flow Integration:**

* Give agents clear instructions about available flows
* Name flows descriptively
* Document flow inputs/outputs
* Test flows independently before giving to agents

**Error Handling:**

* Handle flow failures in agent logic
* Provide fallback options
* Log errors for debugging
* Notify humans when needed

**Performance:**

* Use flows for heavy processing
* Use agents for decision making
* Cache expensive operations
* Monitor execution times

**Cost Optimization:**

* Use appropriate models for agents
* Minimize agent iterations
* Leverage flows for deterministic tasks
* Monitor token usage

> **[Working with AI](https://docs.noxus.ai/platform/scenarios/working-with-ai)**
>
> AI nodes and agents guide

> **[Working with Documents](https://docs.noxus.ai/platform/scenarios/working-with-documents)**
>
> Document processing scenarios


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.