Repository navigation
feat(llc): claude_code adapter — ClaudeCodeAdapter for heartbeat sessions (#8258) - #8530
Merged
Merged
Conversation
Contributor
✅ SSOT Configuration Compliance: Passing🎉 No hardcoded values detected that have SSOT config equivalents! |
…ions (#8258) Implements the claude_code adapter type in the LLC adapter registry. The adapter launches Claude Code CLI subprocesses as agent heartbeat execution vehicles with full session continuity via Redis. - ClaudeCodeAdapter (invoke/status/cancel) registered under "claude_code" - invoke: spawns claude CLI with --output-format stream-json; fat context (rag_brief) or thin context (task_id + api_base_url) prompt modes; --allowedTools, --model, --max-turns from adapter_config - Session continuity: session ID stored in Redis llc:agent:{id}:claude_session with 4h TTL; --resume used on subsequent heartbeats - status: reads state file for PID + timeout check; probes pid 0 for liveness - cancel: SIGTERM → probe loop → SIGKILL; clears Redis session on cancel - Output captured to /tmp/llc_agent_{agent_id}_{run_id}.jsonl for KB indexer - All adapter errors caught and returned as AdapterRunStatus.failed - Unit tests: invoke/status/cancel with mock subprocess + Redis Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements GH#8258 — the
claude_codeadapter type for the LLC adapter registry, enabling agents to run Claude Code CLI sessions as their heartbeat execution vehicle.What's included
claude_code_adapter.py—ClaudeCodeAdapterimplementinginvoke / status / cancelinvoke: launchesclaudeCLI subprocess with--output-format stream-json; supports fat-context mode (RAG brief as prompt) and thin-context mode (task_id + API URL); passes--model,--max-turns,--allowedToolsfromadapter_configstatus: reads state file for PID + timeout; probes withkill(pid, 0)for liveness; returnsRUNNING / COMPLETED / FAILED / TIMEOUTcancel: SIGTERM → probe loop → SIGKILL; clears Redis session on terminationllc:agent:{id}:claude_sessionwith 4h TTL;--resume {session_id}used on subsequent heartbeats/tmp/llc_agent_{agent_id}_{run_id}.jsonlfor KB indexer pickup; state file written alongsideAdapterRunStatusClaudeCodeAdapter()registered under"claude_code"inadapters/__init__.pytest_claude_code_adapter.py— invoke/status/cancel with mock subprocess + Redis, protocol conformance, registry checkTest plan
python3 -m py_compile autobot-backend/llc/adapters/claude_code_adapter.py✅python3 -m py_compile autobot-backend/llc/adapters/tests/test_claude_code_adapter.py✅from llc.adapters import get_adapter; get_adapter("claude_code")returnsClaudeCodeAdapterCloses #8258
🤖 Generated with Claude Code