Repository navigation
v0.4.4 - Proper session lifecycle management
What's Changed
Fix: Unclosed client sessions
Added proper lifecycle management to ClaudeAcpAgent and ClaudeClient to prevent unclosed subprocess connections (and associated aiohttp session warnings).
New methods:
ClaudeAcpAgent.close()/close_session(session_id)— properly disconnectsClaudeSDKClientinstancesClaudeClient.close()— delegates to agent cleanup- Both now support
async withcontext manager for automatic cleanup
Usage:
# Recommended: async context manager
async with ClaudeClient(cwd=".") as client:
response = await client.query("Hello")
# Or manual cleanup
client = ClaudeClient(cwd=".")
try:
response = await client.query("Hello")
finally:
await client.close()Also:
run()entry point now ensuresagent.close()on shutdown viatry/finally- Updated README examples to use
async withpattern - Added unit tests for lifecycle methods