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

# FlowsAgent

> Agent with Pipecat Flows integration for structured conversations

## Overview

`FlowsAgent` extends [`BaseAgent`](/api-reference/pipecat-subagents/base-agent) with [Pipecat Flows](/api-reference/pipecat-flows/overview) for structured conversation flows. It manages a `FlowManager` for node-based conversations with functions, transitions, and actions.

On first activation the flow starts at `build_initial_node()`. Subsequent activations resume from `build_resume_node()`.

<Note>
  Requires the flows extra: `uv add "pipecat-ai-subagents[flows]"`

  Imported from `pipecat_subagents.agents.flows_agent`:

  ```python theme={null}
  from pipecat_subagents.agents.flows_agent import FlowsAgent
  ```
</Note>

```python theme={null}
class MyFlowsAgent(FlowsAgent):
    def build_llm(self):
        return OpenAILLMService(api_key="...")

    def build_initial_node(self):
        return {"name": "start", ...}
```

## Configuration

Inherits all parameters from [`BaseAgent`](/api-reference/pipecat-subagents/base-agent#configuration).

<ParamField path="name" type="str" required>
  Unique name for this agent.
</ParamField>

<ParamField path="bus" type="AgentBus" required>
  The [`AgentBus`](/api-reference/pipecat-subagents/bus#agentbus) for
  inter-agent communication.
</ParamField>

<ParamField path="context_aggregator" type="Any" required>
  The context aggregator pair for managing LLM conversation context, forwarded
  to `FlowManager`.
</ParamField>

<ParamField path="context_strategy" type="ContextStrategyConfig | None" default="None">
  Optional context strategy forwarded to `FlowManager`. See
  [ContextStrategyConfig](/api-reference/pipecat-flows/types#contextstrategyconfig).
</ParamField>

<ParamField path="global_functions" type="list[FlowsFunctionSchema | FlowsDirectFunction] | None" default="None">
  Optional list of functions available at every node, forwarded to
  `FlowManager`. Methods decorated with
  [`@tool`](/api-reference/pipecat-subagents/decorators#tool) are automatically
  included as global functions.
</ParamField>

<ParamField path="active" type="bool" default="False">
  Whether the agent starts active. Defaults to `False`.
</ParamField>

<ParamField path="bridged" type="tuple[str, ...] | None" default="()">
  Bridge configuration. Defaults to an empty tuple (bridged, accepting all
  bridges).
</ParamField>

## Properties

Inherits all properties from [`BaseAgent`](/api-reference/pipecat-subagents/base-agent#properties).

### flow\_manager

```python theme={null}
agent.flow_manager -> FlowManager | None
```

The `FlowManager` instance, available after the pipeline task is created.

## Abstract Methods

### build\_llm

```python theme={null}
@abstractmethod
def build_llm(self) -> LLMService
```

Return the LLM service for this agent.

**Returns:** An `LLMService` instance.

### build\_initial\_node

```python theme={null}
@abstractmethod
def build_initial_node(self) -> NodeConfig
```

Return the initial flow node configuration. Called on first activation.

**Returns:** A `NodeConfig` describing the first node of the flow.

## Methods

### build\_resume\_node

```python theme={null}
def build_resume_node(self) -> NodeConfig
```

Return the node to resume from when re-entering this agent. Called on subsequent activations (after the first). Override to resume from a specific point in the flow based on `flow_manager.state`. Defaults to restarting from the initial node.

**Returns:** A `NodeConfig` for the resumption point.

### on\_activated

```python theme={null}
async def on_activated(self, args: dict | None) -> None
```

Initialize or resume the flow on activation. On first call, initializes the flow at `build_initial_node()`. On subsequent calls, sets the node from `build_resume_node()`.

| Parameter | Type   | Description |                               |
| --------- | ------ | ----------- | ----------------------------- |
| `args`    | \`dict | None\`      | Optional activation arguments |
