Skip to main content
Anthropic Claude models are first-class citizens in Swarms. Every Claude model — Fable 5, Opus 4.8, Sonnet 4.6, Haiku 4.5, and older Claude 3.x — works through the same Agent interface with no extra setup.

Installation

Environment Setup

Or in a .env file:

Quick Start

The minimum needed to run a Claude agent:

Model Names

Swarms passes model names straight through to LiteLLM. Use the canonical Anthropic identifier:
For Fable 5 specifically, see the dedicated Claude Fable 5 tutorial — it documents the model’s specific constraints (no tools, no temperature).

Fable 5 — Frontier Reasoning

Fable 5 is Anthropic’s state-of-the-art model. It excels at long, complex tasks but does not support tools or temperature. temperature and top_p default to None on Agent, and Swarms leaves unset values out of the request, so you only need to avoid setting them.

Sonnet 4.6 — The Workhorse

Sonnet is the right default for most production agents. It supports tools, vision, streaming, and runs cheaper than Opus or Fable 5.

Haiku 4.5 — Fast & Cheap

Haiku is the right pick for triage, routing, and high-volume work where latency and cost matter.

Extended Thinking

All recent Claude models support extended thinking. Swarms exposes it two ways:
  • reasoning_enabled=True with thinking_tokens sends an explicit thinking budget. thinking_tokens (default 1024) has no effect unless reasoning_enabled=True.
  • reasoning_effort ("low", "medium", "high") is forwarded on its own, and LiteLLM maps it to a thinking budget for Claude.
With either, Swarms forces temperature=1, drops top_p, and raises max_tokens above the thinking budget, as Anthropic requires.
The autonomous loop’s think tool is off by default (think_tool=False), so a model that already reasons natively doesn’t spend an extra round-trip on it. Set think_tool=True only for models that don’t reason natively.

Streaming

Stream tokens straight to stdout:
Or pipe tokens through your own callback:

Vision

Claude has strong vision capabilities. Pass an image path, URL, or base64 string:

Tool Use

Most Claude models (Sonnet, Haiku, Opus) handle long, structured tool-call sequences well:
Fable 5 does not support tools. Use Sonnet or Opus for tool-calling agents.

Multi-Model Patterns

Different Claude models for different jobs in the same workflow:

Production Defaults

For Claude agents in production:

Next Steps