Back to library
AI
best practice

Hot-Swap Agent Configurations Using Session Overrides

Override agent settings per session for flexible, task-specific AI behavior.

Customize agent behavior for a single run by passing overrides during session creation. This avoids cluttering your dashboard with multiple nearly-identical agent configurations.

Claude

The Scenario

You have a standard 'Data Analyst' agent, but for one specific session, you need it to focus exclusively on 'SQL formatting' with a unique system prompt. You don't want to create a whole new permanent agent just for this one-off task.

Before & after

The old way

You would need to define and save a brand-new agent version in the console for every minor variation in task logic. Managing dozens of slightly different agents could take 30–60 minutes of maintenance.

With AI

With the 'agent_with_overrides' type, you can swap the model or system prompt in 1–2 minutes using a single API call for that specific task.

The Prompt

Show me how to use the 'agent_with_overrides' parameter when creating a Claude Managed Agents session. I want to override the 'system_prompt' and 'model' just for this specific session without changing my main agent configuration.

Instead of creating a permanent new agent for every sub-task, use the 'type: agent_with_overrides' property when initiating a session. This allows you to temporarily change the system prompt, tools, or even the model (e.g., swapping to Sonnet 5 for a specific run) without altering the global agent definition.

Source

Claude Platform - Claude Platform Docs
"Pass agent with type: 'agent_with_overrides' to replace the model, system prompt, tools, MCP servers, or skills for a single session."