Skip to main content
Run agents using agent.run() to process messages and get responses. Supports streaming, structured outputs, and runtime knowledge base integration.

Quick Start

Function Signature

Parameters

Return Value

The return type depends on configuration:

Basic Usage

Simple Run

With Session ID

Maintain conversation context across multiple runs:

With User ID


Streaming Responses

Get real-time responses as they’re generated:

AgentStream Properties

Streaming with Progress


Structured Outputs

Get type-safe responses using Pydantic models:

Nested Models

Streaming with Structured Output


Runtime Knowledge Bases

Pass knowledge bases at runtime for RAG:

Multiple Knowledge Bases

Custom KB Configuration

Use with_config() to customize retrieval settings:

AgentResponse Object

The response object contains:

Working with Responses


Error Handling


Examples

Chatbot with Memory

Document Q&A

Data Extraction