Skip to content

refactor!: redesign Agent Lightning for the next major version - #531

Closed
huzhen (hihuzhen) wants to merge 71 commits into
microsoft:mainfrom
YanbiaoLab:feature/major-version-iteration
Closed

refactor!: redesign Agent Lightning for the next major version#531
huzhen (hihuzhen) wants to merge 71 commits into
microsoft:mainfrom
YanbiaoLab:feature/major-version-iteration

Conversation

@hihuzhen

Copy link
Copy Markdown

No description provided.

Status: complete task 1.x contract stabilization (1.1~1.6).

- freeze AlgorithmContext usage and context-aware algorithm adapter execution

- align Algorithm.run/trainer/litagent paths to context contract

- lock core runtime types (RolloutResult, AgentSpanPayload, SpanWriteResult, SpanWriter) and status transition boundaries

- clarify store state transition ownership rules and baseline span rewrite behavior

- include regression tests in apo/baseline/decorator/runner/store/core/trainer/types

- verification: uv run --no-sync pytest tests/algorithm/test_apo.py tests/algorithm/test_baseline.py tests/algorithm/test_decorator.py tests/runner/test_agent_runner.py

- verification: uv run --no-sync pytest tests/store/test_core.py tests/store/test_utils.py tests/trainer/test_trainer_dev.py tests/types/test_core.py -m "not mongo"
Status: update task 2 to completed in major-version todo list.

- normalize queueing wording to queuing in store runtime docs/comments and deep-dive docs

- fix state transition guard that used non-existent 'queueing' rollout status literal

- run smoke test: pytest tests/store/test_core.py -k dequeue_rollout_skips_non_queuing_status -m 'not mongo'
Note:
- Remove legacy trainer component builders and registry helpers so core Trainer accepts concrete component instances only.
- Default missing algorithms through Baseline while keeping internal algorithm state non-optional.
- Clean agentlightning typing boundaries across stores, tracers, instrumentation, VERL, Weave, emitters, adapters, and utilities without broad type widening.
- Update examples, docs, benchmarks, and trainer tests for the stricter Trainer API.

Verification:
- UV_CACHE_DIR="/Users/zhen/projects/agent-lightning/.cache_uv" XDG_CACHE_HOME="/Users/zhen/projects/agent-lightning/.cache_xdg" uv run --no-sync pyright agentlightning
- UV_CACHE_DIR="/Users/zhen/projects/agent-lightning/.cache_uv" UV_TOOL_DIR="/Users/zhen/projects/agent-lightning/.uv_tools" uvx ruff check <changed Python files>
- UV_CACHE_DIR="/Users/zhen/projects/agent-lightning/.cache_uv" XDG_CACHE_HOME="/Users/zhen/projects/agent-lightning/.cache_xdg" uv run --no-sync black --check <changed Python files>
- UV_CACHE_DIR="/Users/zhen/projects/agent-lightning/.cache_uv" XDG_CACHE_HOME="/Users/zhen/projects/agent-lightning/.cache_xdg" uv run --no-sync isort --check-only <changed Python files>
- UV_CACHE_DIR="/Users/zhen/projects/agent-lightning/.cache_uv" XDG_CACHE_HOME="/Users/zhen/projects/agent-lightning/.cache_xdg" uv run --no-sync pytest -q tests/trainer/test_trainer_init.py tests/trainer/test_trainer_dev.py tests/litagent tests/emitter tests/types/test_resources.py tests/utils/test_otel.py tests/adapter tests/store/test_core.py tests/store/test_threading.py -m "not mongo"
Use a concrete default algorithm instead of overloading None, preserve precise span batch outcomes, and drain claimed runner work before managed store shutdown. Remove the unused resource registry path and update regression tests and optimization notes.
Bound runner draining before shutdown escalation, propagate APO template failures, reject conflicting runner counts, and forbid unsupported agent span payload fields. Report bulk span outcomes from backend-confirmed item indexes and treat unknown writes as failures; update regression tests and optimization notes.
Copilot AI review requested due to automatic review settings July 13, 2026 05:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants