lablup / lablup/backend.ai

Agent operation step recorder + structured message egress (mirrors Sokovan recorder pattern)

Open
#12,618 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

Not a generic ObservabilityProducer - mirror Sokovan's scheduling-history step collection on the agent side. Sokovan (sokovan/recorder/) uses RecorderContext (ContextVar scope) + TransitionRecorder phase(name)/step(name) context managers that auto-append structured StepRecord (name/status/timing/error_code), flattening phases->steps into one history at scope exit (Sokovan persists to DB). On the agent, wrap the structured operations (kernel create/destroy stages) in phase()/step() to extract structured step messages and emit them to the Manager (Agent->Manager stays event-only per AGENTS.md). Scattered runtime/resource state becomes observable at step granularity beyond heartbeat. Reference: sokovan/recorder/{types.py (StepRecord/PhaseRecord), recorder.py, context.py, pool.py}. Message schema/delivery (event emit vs manager-stored history) decided in this story.

Success Criteria:
- [ ] Agent create/destroy operations wrapped in phase()/step() accumulate structured StepRecords.
- [ ] At scope exit, steps are emitted to the Manager as structured messages (event-only path).
- [ ] On failure, error_code is recorded on the step (same shape as Sokovan recorder).
- [ ] Manager can receive/consume the structured step messages (schema documented).
- [ ] pants test passes for affected packages

JIRA Issue: BA-6764

Contributor guide

Open the contributing guide

Research direction

Start by reading sokovan/recorder/types.py, recorder.py, context.py, and pool.py to understand StepRecord, PhaseRecord, and scope handling. Then locate the agent create/destroy operations and the Manager event path described in the issue. Done means structured steps are emitted at scope exit, failures include error_code, the Manager can consume the documented schema, and affected pants tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, distributed-systems, observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.