Documents
Home>Documents>AI>Agent>Geny

Claude Control: Building a Multi-Session AI Agent Manager

10 min readFeb 19, 2026Feb 22, 2026

Claude Control: Building a Multi-Session AI Agent Management System

Why Multi-Session Management?

When using Claude Code CLI in production, a single session quickly becomes a bottleneck. Different projects need isolated work environments, multiple tasks need to run concurrently, and in Kubernetes environments, managing sessions across multiple Pods is a hard requirement.

Claude Control was built to address these needs. It manages multiple Claude Code sessions, supports Autonomous Mode, and integrates GitHub automation into a single system.

System Architecture

┌─────────────────────────────────────────┐
│           Claude Control                 │
├─────────────────────────────────────────┤
│   [API Layer - FastAPI]                  │
│   ├── POST /api/sessions (세션 생성)      │
│   ├── POST /sessions/{id}/execute        │
│   └── DELETE /sessions/{id}              │
│                                          │
│   [Session Manager]                      │
│   ├── 세션 생명주기 관리                    │
│   ├── Redis 기반 메타데이터 저장            │
│   └── 멀티 Pod 세션 라우팅                 │
│                                          │
│   [Claude Process]                       │
│   ├── Claude CLI 프로세스 관리             │
│   ├── 독립 스토리지 디렉토리               │
│   └── 프롬프트 실행 및 응답 수집            │
└─────────────────────────────────────────┘

Core Components

1. Session Manager
Session metadata is stored in Redis and shared across Pods. Beyond basic create/read/delete operations, this component also handles automatic garbage collection of dead sessions.

2. Process Manager
Each session runs as an independent Claude CLI process. The Process Manager monitors process health and performs cleanup when a process terminates abnormally.

3. MCP Auto-loading
Drop a JSON config file into the mcp/ folder and the MCP server loads automatically. Likewise, Python files placed in the tools/ folder are automatically registered as custom tools.

Autonomous Mode

The most powerful feature of Claude Control is Autonomous Mode, which lets Claude complete tasks end-to-end without human confirmation.

# Autonomous execution: from Next.js project creation to Git push
curl -X POST http://localhost:8000/api/sessions/{id}/execute \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Create a complete Next.js 14 project with App Router, 
               Tailwind CSS, TypeScript. Initialize git, commit, 
               and push to repository.",
    "timeout": 1800,
    "skip_permissions": true,
    "system_prompt": "Complete all tasks without asking for confirmation."
  }'

GitHub Automation Integration

Integrating with the GitHub CLI (gh) enables full end-to-end automation — cloning repositories, creating branches, modifying code, and opening PRs:

# Automated code review + security audit + PR creation
curl -X POST http://localhost:8000/api/sessions/{id}/execute \
  -d '{
    "prompt": "Clone repo, review all code for bugs and security issues, 
               fix problems, create branch fix/security-audit, 
               commit all fixes, push, and create a PR."
  }'

Dashboard

Over 88 commits, a management dashboard was built with the following features:

  • Session monitoring: Real-time status and resource usage for active sessions
  • Log management: View and search execution logs per session
  • Deleted session management: Track history of terminated sessions
  • Configuration management: Centralized management of environment variables, API keys, and more

The dashboard is implemented with server-side rendering via Jinja2 templates and styled with SCSS modules.

KakaoTalk Chatbot Integration

Claude Control also supports integration with a KakaoTalk chatbot. A sub-config structure under the config/ folder keeps external service configurations modular:

# Sub-config structure
config/
├── base_config.py       # 기본 설정
└── sub_config/
    ├── kakao_config.py  # KakaoTalk 설정
    ├── redis_config.py  # Redis 설정
    └── ...

Troubleshooting: Autonomous Graph

During development of Autonomous Mode, an Autonomous Graph was implemented to select execution strategies based on task complexity. The initial linear execution approach wasn't sufficient for complex tasks that required loops and branching. Drawing on LangGraph's graph structure as a reference, a difficulty-based task execution graph was designed.

After the implementation was in place, a fair amount of cleanup was needed to remove accumulated cruft:

  • Deleted files related to Autonomous Graph visualization
  • Cleaned up prompt instructions files
  • Refactored the codebase for a cleaner structure

Retrospective

Building Claude Control across 88 commits drove home just how complex AI agent management can be. The two biggest challenges were session routing in a multi-Pod environment and ensuring the safety of autonomous execution. Both were addressed through Redis-based session sharing and behavioral constraints enforced via system prompts.

Tags
ClaudeAnthropicAgentmulti-sessionPythonTextual