What This Example Shows
- How to point a single agent at Claude Opus 4.8
- How to run a hierarchical multi-agent swarm on Opus 4.8
- The correct model name to use (
anthropic/claude-opus-4-8) - Why you should omit
temperaturefor this model
Claude Opus 4.8 is Anthropic’s most capable reasoning model. It is wired into every multi-agent primitive on the Swarms platform — sequential workflows, hierarchical swarms, agent rearrange, group chats, mixture-of-agents, and more. Switching is a one-line change in your agent config.
Step 1: Get Your API Key
- Visit https://swarms.world/platform/api-keys
- Sign in or create an account
- Generate a new API key
- Set it as an environment variable:
Step 2: Install the Swarms Python Client
Single Agent on Claude Opus 4.8
A minimal single-agent call. Note themodel_name is the only thing that changes from any of your existing agent configs — temperature is intentionally absent.
| Field | Before | With Opus 4.8 |
|---|---|---|
model_name | gpt-4.1, claude-haiku-4-5-20251001, etc. | anthropic/claude-opus-4-8 |
temperature | 0.5 (or any float) | omit the field entirely |
| Everything else | — | unchanged |
Multi-Agent Swarm on Claude Opus 4.8
The same model name plugs into every multi-agent architecture. This example uses aHierarchicalSwarm where an auto-generated director coordinates two worker analysts — one for ETFs, one for individual stocks.
For
HierarchicalSwarm, you only need to define the worker agents — the director is automatically created and orchestrated by the framework. The director routes the task to each worker, collects their outputs, and synthesizes a final response.Using Opus 4.8 in Other Swarm Types
Every other swarm architecture takes the samemodel_name. Drop "model_name": "anthropic/claude-opus-4-8" into any agent inside any of these swarm configs:
SequentialWorkflowConcurrentWorkflowAgentRearrangeMixtureOfAgentsGroupChatMajorityVotingCouncilAsAJudgeMultiAgentRouterHeavySwarmLLMCouncilDebateWithJudgeBatchedGridWorkflowRoundRobinPlannerWorkerSwarmauto
Common Pitfalls
500 error: '`temperature` is deprecated for this model.'
500 error: '`temperature` is deprecated for this model.'
You set
temperature in your agent_config. Remove the field entirely — the Swarms API will then omit it from the upstream Anthropic call. If you have legacy code that always sends a float, set it to None and rely on the Swarms API to strip it.422 error on swarm_type
422 error on swarm_type
Use
HierarchicalSwarm (correctly spelled). Earlier versions of the API accepted the misspelled HiearchicalSwarm; the current schema only accepts the correct spelling.Where do I find pricing?
Where do I find pricing?
Opus 4.8 pricing follows Anthropic’s published rates and is reflected in the Swarms cost-tracking endpoints. See the pricing page for current rates.
Next Steps
- Browse the Multi-Agent Architectures catalog for more swarm types
- Read the Single Agent Overview for the full agent config surface
- See Streaming to stream Opus 4.8 tokens to your client in real time