lablup / lablup/backend.ai

Agent Kernel Lifecycle Structuring

Open
#11,649 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
15h 13m
Merged PRs (30d)
368

Description

Structure Agent kernel lifecycle (create/prepare/terminate) into state-machine-based handlers, mirroring the sokovan Coordinator pattern, and guarantee event delivery to the Manager at each stage transition.

Background: create_kernel() is a single monolithic function handling image pull → resource allocation → container creation → kernel init in hundreds of lines. Files under agent/stage/kernel_lifecycle/docker/ exist per stage but are not wired into a state machine. Task tracking is minimal (CreateTaskInfo holds only kernel_id and session_id). Agent CLAUDE.md states container state transitions MUST go through agent/stage/, but this is currently unimplemented.

JIRA Issue: BA-6074

Contributor guide

Open the contributing guide

Research direction

Start at create_kernel() and inspect the per-stage files under agent/stage/kernel_lifecycle/docker/. Read the sokovan Coordinator pattern and agent/CLAUDE.md, then trace CreateTaskInfo and current Manager event handling. Done means create, prepare, and terminate use state-machine handlers and the Manager receives an event at each stage transition.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
backend, distributed-systems
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.