Skip to main content

Agent

The core class for AI agents with tools, memory, knowledge, and handoffs.

Param Cluster Map

Note: base_url and api_key remain separate (connection/auth constraint).

Precedence Ladder

Instance > Config > Array > Dict > String > Bool > Default

Quick Start

Parameters Table

Core Identity

LLM Configuration

Tools & Capabilities

Deprecated Standalone Params

These still work for backward compatibility but emit DeprecationWarning. Use the consolidated config objects instead.

Consolidated Feature Params

Each follows: False=disabled, True=defaults, Config=custom

Precedence Ladder

Resolution Order: Instance > Config > Array > Dict > String > Bool > DefaultWhen you pass a consolidated param, the resolver checks in this order:
  1. Instance - Already a config object? Use as-is
  2. Config - Dataclass instance? Use as-is
  3. Array - ["preset", {"override": value}]? Apply overrides
  4. Dict - {"key": value}? Convert to config
  5. String - "preset_name" or URL? Look up preset or parse URL
  6. Bool - True? Use defaults. False? Disable
  7. Default - None? Use default value

Usage Forms Table

Examples for Each Form

Presets & Options

Output Presets

Aliases: "text", "actions""status" | "plain", "minimal""silent" | "normal""verbose"

Execution Presets

Memory Presets

Web Presets

Reflection Presets

Guardrail Presets

Methods

Execution Methods

Async Execution Methods

Other Methods

Class Methods

Common Recipes

Simple Agent with Instructions

Agent with Tools

Agent with Handoffs

Agent with Knowledge Base

Agent with Streaming

Choose the right method based on your use case:
Streaming Precedence: start(stream=True/False) overrides OutputConfig.stream.
  • output="stream" sets stream=True by default
  • start(stream=False) can disable streaming even with output="stream"
  • start(stream=True) enables streaming for any preset
When to use which method:
  • output="stream": Agent always streams, no per-call control needed
  • start(stream=True): Control streaming per-call, useful for conditional streaming
  • output="silent" + stream=True: Clean streaming without agent status messages

Agent with Custom LLM

Agent with Consolidated Config

Async Support

The Agent class provides full async support:

Multi-Agent Safe

Agents are designed to be multi-agent safe. Each agent maintains its own:
  • Chat history
  • Memory instance
  • Knowledge base
  • Session state
Multiple agents can run concurrently without interference.

See Also