🧩ClaudeSDKClient
Also known as Python SDK client, ClaudeSDKClient class
A Python class that keeps one chat open for many prompts.
Think of it like
It is like a phone call you keep open. You do not hang up after each question.
Example
Mia builds a chat app in Python. She keeps one ClaudeSDKClient per user, so each follow-up knows the earlier messages.
Why it matters
A chat needs memory across prompts, and the client keeps it with no IDs to track.
Definition
Example code
python
async with ClaudeSDKClient() as client:
await client.query("Read auth.py")
async for m in client.receive_response():
print(m)Common mistake
Key takeaways
- 1One open session. Many prompts.
- 2receive_response(). Reads the reply.
- 3Python only. TypeScript uses continue.