🧩Claude Agent SDK Session Pattern
Also known as Agent SDK Session Pattern, Ephemeral Session, Long-Running Session, Hybrid Session, Agent SDK session patterns
How long an agent's box lives, next to the work it has to do.
Think of it like
It is like a sitter. She can come once, stay all day, or come back when called.
Example
A tool that turns one PDF into a table uses ephemeral sessions. A Slack bot that never stops uses a long-running one.
Why it matters
The pattern sets your cost and your start-up wait. It also decides if a user's old chat is still there.
Definition
Common mistake
Key takeaways
- 1Ephemeral. One task, then gone.
- 2Long-running. Always up.
- 3Hybrid. Sleeps, then reloads.