<a id="ai-streaming-agents-overview"></a>

# Streaming Agents with Confluent Intelligence in Confluent Cloud

Streaming Agents are event-driven AI agents that run natively on Flink within
your data streams. They monitor and act on real-time business events to power
intelligent, context-aware automation.

With Confluent Intelligence, you build, deploy, and orchestrate Streaming Agents
directly on Confluent Cloud.

Streaming Agents use tools to interact with external systems, perform actions,
or retrieve information as part of an AI workflow. By invoking tools, agents
extend their capabilities beyond simple data processing, enabling more complex
and dynamic workflows in streaming applications.

Streaming Agents provide a comprehensive platform for building AI-powered
streaming applications with high-level abstractions, debugging capabilities,
and robust agent orchestration that makes it easier to build, test, and deploy
intelligent streaming workflows.

![Streaming Agents overview](ai/images/streaming-agents-overview.svg)

Streaming Agents include these capabilities:

- [Function call agent](#ai-streaming-agents-overview-function-call-agent):
  High-level agent definition that abstracts away orchestration logic
- [Tool Calling with MCP](#ai-streaming-agents-overview-mcp):
  Enable agents to use the right tools at the right time
  with Model Context Protocol (MCP) integration
- [Agent Runtime](#ai-streaming-agents-overview-agent-runtime):
  Robust execution engine with MCP integration and tool calling
- [Reflection workflows](reflection-workflow.md#streaming-agents-reflection-workflow):
  Iterative self-correction through drafter-critic loops for
  higher-quality agent output
- [Replayability](#ai-streaming-agents-overview-replayability):
  First-class debugging and testing capabilities for agent sessions
- [Monitoring](monitor-streaming-agents.md#monitor-streaming-agents):
  Structured execution logging through system log tables for
  real-time observability into agent workflows

<a id="ai-streaming-agents-overview-function-call-agent"></a>

## Function call agent

The function call agent provides a declarative way to
define AI agents by using familiar constructs:

- **Role**: Define what the agent does through prompts.
- **Capabilities**: Specify tools the agent can use (functions, MCP servers).
- **Model**: Reference to the large language model (LLM) that powers the
  agent’s reasoning.

This abstraction eliminates the need to manually chain SQL operators or Table
API calls, making it much easier to express dynamic reasoning loops and build
modular, testable agents.

The function call agent on Confluent Cloud has these benefits:

- Intuitive agent definition using SQL DDL statements
- Automatic orchestration of reasoning and tool invocation loops
- Native integration with Flink’s event-driven runtime
- Support for both function-based and MCP-based tools

<a id="ai-streaming-agents-overview-mcp"></a>

## Tool calling with MCP

![Agent calling tools with Confluent Intelligence](ai/images/agent-calling-tools.svg)

Streaming Agents invoke the right tools at the right time by using MCP
integration, which brings tool calling into data streams for fast, reliable,
and context-aware automation.

- **MCP Client Support**: Use MCP client support in Flink for contextual tool
  invocation
- **Flexible Tool Definition**: Define tools in an MCP server or as UDFs
- **Traceability and Auditability**: All tool interactions are logged for
  complete visibility
- **Contextual Decision Making**: Agents select appropriate tools based on
  real-time business context

<a id="ai-streaming-agents-overview-reflection"></a>

## Reflection workflows

Reflection workflows enable iterative self-correction through a
drafter-critic loop. You define a composite reflection agent that
orchestrates two sub-agents: a drafter that generates output and a
critic that evaluates it. The loop continues until the critic
approves the output or the iteration limit is reached, producing
higher-quality results for complex analytical tasks.

For more information, refer to
[Improve Agent Output with Reflection Workflows](reflection-workflow.md#streaming-agents-reflection-workflow).

<a id="ai-streaming-agents-overview-replayability"></a>

## Replayability

Replayability makes debugging and testing AI agents a first-class feature by
capturing every agent interaction in real-time:

- **Event Traceability**: Complete timeline of events, decisions, and tool
  calls
- **Safe Replay**: Test new agent versions against historical data without side
  effects
- **Comparative Analysis**: Compare outputs between different agent versions

The replayability feature on Confluent Cloud has these benefits:

- Full visibility into agent behavior and decision-making
- Safe testing of agent changes against real-world event streams
- Time-travel debugging capabilities
- A/B testing
- Regression validation

<a id="ai-streaming-agents-overview-agent-runtime"></a>

## Agent runtime

The [agent runtime](agent-runtime-guide.md#streaming-agents-runtime) provides a robust execution
engine that handles:

- **Tool Integration**: Seamless integration with MCP servers and Flink
  functions
- **State Management**: State handling to recover from errors
  conversations
- **Error Handling**: Robust error handling and retry mechanisms
- **Observability**: Comprehensive logging and metrics for agent execution
- **Scalability**: Scalable execution across Flink clusters

## Architecture overview

Streaming Agents build on the Confluent Cloud for Apache Flink infrastructure. The system processes
streaming events through agent workflows, capturing all interactions for
debugging and replay capabilities.

Key components include:

- **Agent Runtime**: Orchestrates iterative loops and tool execution
- **Model Inference**: Handles LLM interactions and reasoning
- **Tool Integration**: Manages function-based and MCP-based tools
- **Session Store**: Maintains conversation state and context
- **Replay Engine**: Enables debugging and testing capabilities

![Streaming Agents architecture overview](ai/images/streaming-agents-architecture.svg)

## Scaling and multi-agent systems

Streaming Agents scale to power any use case without reinventing your
architecture. The platform supports multiple architectural patterns for complex
agent workflows:

Event-Driven Architecture
: - Decoupled, immutable architecture with robust security controls
  - Real-time and performant processing with fully managed cloud-native service
  - 120+ pre-built connectors for seamless data integration

Integration Ecosystem
: - **Data Sources**: Browser, mobile, telemetry, data warehouses, data lakes,
    SaaS apps
  - **Stream Processing**: Event-driven processing with governance and security
  - **Data Sinks**: Data warehouses, data lakes, CRM, CDP, apps, and
    microservices
  - **AI Services**: Tools (MCP), LLMs, vector stores, and external services

![Streaming Agents scaling and multi-agent systems](ai/images/streaming-agents-scaling.svg)

## Use cases

Streaming Agents enable a wide range of intelligent streaming applications.

Customer service automation
: - Real-time customer query processing
  - Automated ticket routing and resolution
  - Multi-agent workflows for complex issues

Financial services
: - Real-time fraud detection and prevention
  - Automated trading decisions
  - Risk assessment and compliance monitoring

IoT and edge computing
: - Intelligent sensor data processing
  - Predictive maintenance workflows
  - Automated response to equipment failures

Content processing
: - Real-time content moderation
  - Automated content categorization
  - Dynamic content personalization

## Model support

Streaming Agents support the following models:

- Anthropic
- Gemini
- OpenAI

## Getting started

To get started with Streaming Agents:

1. **Define Tools**: Create function-based or MCP-based tools by using the
   [CREATE TOOL](../../flink/reference/statements/create-tool.md#flink-sql-create-tool) statement.
2. **Create Agents**: Define agents with models, prompts, and tools by using the
   [CREATE AGENT](../../flink/reference/statements/create-agent.md#flink-sql-create-agent) statement, or use the
   [Confluent Cloud Console](manage-agents-console.md#streaming-agents-console) for a guided,
   no-code experience.
3. **Execute Agents**: Run agents on streaming data using the
   [AI_RUN_AGENT](../../flink/reference/functions/model-inference-functions.md#flink-sql-ai-run-agent-function) function.
4. **Refine with Reflection**: Use
   [reflection workflows](reflection-workflow.md#streaming-agents-reflection-workflow)
   to iteratively improve agent output quality.
5. **Debug and Replay**: Use [replay capabilities](debug-streaming-agents.md#debug-streaming-agents)
   to test and debug agent behavior.
6. **Monitor agents (Optional)**: Use
   [system log tables](monitor-streaming-agents.md#monitor-streaming-agents) to capture
   agent execution logs for real-time monitoring.

### Quick Start

Use the [Streaming Agents Quickstart repo](https://cnfl.io/quickstart-agents)
to build your first Streaming Agent in minutes.

For detailed guides, see:

- [Build and Run Streaming Agents](create-and-run-streaming-agents.md#streaming-agents-build-and-run)
- [Debug Streaming Agents](debug-streaming-agents.md#debug-streaming-agents)
- [Agent Runtime Guide](agent-runtime-guide.md#streaming-agents-runtime)
- [Examples and Tutorials](streaming-agents-examples.md#streaming-agents-examples)

<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; height: auto;">
   <iframe src="https://www.youtube.com/embed/F4bUUsVDBVE?si=ZYU7op8LBcCoPO4l" frameborder="0" allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe>
</div>
<br/>

## Next steps

- [Build and Run Streaming Agents](create-and-run-streaming-agents.md#streaming-agents-build-and-run)
- [Improve Agent Output with Reflection Workflows](reflection-workflow.md#streaming-agents-reflection-workflow)
- [Monitor Streaming Agents](monitor-streaming-agents.md#monitor-streaming-agents)
- [Debug Streaming Agents](debug-streaming-agents.md#debug-streaming-agents)
- [Agent Runtime Guide](agent-runtime-guide.md#streaming-agents-runtime)
- [Examples and Tutorials](streaming-agents-examples.md#streaming-agents-examples)
- [Invoke a Tool in an AI Workflow](../builtin-functions/invoke-tool-ai-workflow.md#ai-invoke-tool-in-workflow)

## Related content

- Blog post: [Unleash Real-Time Agentic AI: Introducing Streaming Agents on Confluent Cloud](https://www.confluent.io/blog/introducing-streaming-agents/)
- [AI_TOOL_INVOKE function](../../flink/reference/functions/model-inference-functions.md#flink-sql-ai-tool-invoke-function)
- [Built-in AI/ML Functions](../builtin-functions/overview.md#ai-builtin-functions-overview)
- [Search over External Tables](../external-tables/overview.md#ai-external-tables-overview)

#### NOTE
This website includes content developed at the [Apache Software Foundation](https://www.apache.org/)
under the terms of the [Apache License v2](https://www.apache.org/licenses/LICENSE-2.0.html).
