註冊並分享邀請連結,可獲得影片播放與邀請獎勵。

cv usk
@cv_usk
AI / Software Research Notes AI Agent, LLMOps, MLOps, Software Architecture
加入 May 2026
238 正在關注    213 粉絲
# Practical ways to use the Claude Agent SDK 💬 Continue, resume, and fork agent conversations to tackle complex tasks across multiple turns. Session Management uses `continue`, `resume`, and `fork` to maintain context across multi-turn conversations. 📌 Title: Working with Sessions 🔗 URL: 🧩 Overview Sessions preserve conversation context. Python uses `ClaudeSDKClient` (auto session ID management), TypeScript uses `continue: true`. `resume` restarts interrupted sessions, and `fork_session` branches history to explore alternatives. 🛠 How to use it ```python options = ClaudeAgentOptions(resume=session_id) # Resume options = ClaudeAgentOptions(fork_session=True) # Fork ``` 🏗 Practical usage - Build multi-turn conversations: "Analyze the auth module" → "Refactor it to use JWT" with full context preserved. - Resume sessions that ended with `error_max_turns` using `resume` with higher limits. - Use `fork_session=True` to explore an OAuth2 approach without destroying the original JWT approach. Two independent histories are maintained. - Build session picker UIs with `list_sessions` / `get_session_messages` / `rename_session`. 💡 Use cases 🔄 Resuming sessions after hitting limits 🌿 Parallel exploration of alternative approaches via fork 🗂 Building session management UIs ⚠️ Watch out Sessions are saved at `~/.claude/projects//.jsonl`. Cross-host resume requires matching `cwd`. Sub-agent transcripts persist independently from the main conversation. #ClaudeAgentSDK# #AI#
顯示更多