feat(instrument): Port AutoGen framework adapter (M2)#101
Closed
mmercuri wants to merge 2 commits into
Closed
Conversation
Port the AutoGen framework adapter from the ateam reference implementation onto the new layerlens.instrument base layer. This is the M2 fan-out per-adapter PR for AutoGen — replaces the AutoGen slice of the larger orchestration bundle (PR #96) with a self-contained, mergeable unit. Source: A:/github/layerlens/ateam/stratix/sdk/python/adapters/autogen/ (~1,213 LOC, 6 files) Template: src/layerlens/instrument/adapters/frameworks/langchain/ Scope ----- - src/layerlens/instrument/adapters/frameworks/autogen/ - __init__.py — public surface + ADAPTER_CLASS + instrument_agents - lifecycle.py — AutoGenAdapter (BaseAdapter subclass) - wrappers.py — traced send/receive/generate_reply/execute_code - groupchat.py — GroupChatTracer (multi-agent turn management) - human_proxy.py — HumanProxyTracer (HITL classification) - metadata.py — environment.config payload extractor - tests/instrument/adapters/frameworks/test_autogen.py — 13 SDK-shape mocked tests (no pyautogen install required) - samples/instrument/autogen/main.py — runnable end-to-end demo with mocked LLM + duck-typed agent - docs/adapters/frameworks/autogen.md — install, quick-start, events emitted, capture-config guide - pyproject.toml - autogen = ["pyautogen>=0.2,<0.5; python_version >= '3.10'"] - ARG002 + pyright relaxation for monkey-patched framework code Adaptations from ateam source ----------------------------- - stratix.* imports → layerlens.* (BaseAdapter, CaptureConfig, PydanticCompat, MemoryEntry). - STRATIX docstrings/branding → LayerLens. - Monkey-patched private attributes (_stratix_tracer, _stratix_human_tracer, _stratix_original) gain _layerlens_* primary names with the _stratix_* aliases retained as deprecation shims for ateam-era consumers. - requires_pydantic explicit (V1_OR_V2) — adapter does not import pydantic directly. Acceptance ---------- - pytest tests/instrument/adapters/frameworks/test_autogen.py -x → 13 passed - mypy --strict src/layerlens/instrument/adapters/frameworks/autogen → Success: no issues found in 6 source files - ruff check src/layerlens/instrument/adapters/frameworks/autogen tests/instrument/adapters/frameworks/test_autogen.py → All checks passed - Lazy-import + default-install guards still pass for the frameworks surface (test_layerlens_import_does_not_pull_frameworks + test_instrument_import_does_not_pull_frameworks + test_default_install). - Sample runs end-to-end producing 15 events across 8 event types. Stacks on --------- feat/instrument-base-foundation (PR #93) — provides BaseAdapter, CaptureConfig, EventSink, AdapterRegistry, PydanticCompat, vendored event schemas. Cannot rebase off origin/main alone because the adapter literally subclasses BaseAdapter; merging this requires #93 first. Related ------- - Replaces the AutoGen slice of PR #96 (orchestration bundle) for the per-adapter fan-out review. - Sibling fan-out PRs ship LangChain, LangGraph, CrewAI, Agentforce, Langfuse separately.
7 tasks
…deferred) AutoGenAdapter implements serialize_for_replay (returns a populated ReplayableTrace with events + state snapshots + capture config), but get_adapter_info().capabilities did not declare AdapterCapability.REPLAY. The atlas-app catalog UI reads that list to surface replay support, so customers were told they could not replay traces from AutoGen even though the adapter supports it. PR #119 (brand leak + capability declarations) wired REPLAY for the adapters that lived on its branch; AutoGen was deferred because it lives on its own source-port branch (PR #101). This closes that deferral per CLAUDE.md item 5/11. STREAMING is intentionally NOT declared. Per CLAUDE.md 'no fake claims', a capability is only declared if the adapter actually implements it. The AutoGen integration wraps send / receive / generate_reply / execute_code as discrete method calls rather than streaming entry-points — no per-chunk events flow through the adapter. Tests: added test_declares_replay_capability regression asserting REPLAY appears and STREAMING does NOT. Verification: * uv run --with pytest python -m pytest tests/instrument/adapters/frameworks/test_autogen.py -x -> 14 passed
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
M2 fan-out PR: ports the AutoGen framework adapter from the ateam
reference implementation onto the new
layerlens.instrumentbaselayer. Replaces the AutoGen slice of the larger orchestration bundle
(PR #96) with a self-contained, per-adapter unit suitable for
focused review.
A:/github/layerlens/ateam/stratix/sdk/python/adapters/autogen/(~1,213 LOC, 6 files)
src/layerlens/instrument/adapters/frameworks/langchain/feat/instrument-base-foundation) — required for theBaseAdapter/CaptureConfig/EventSinksurface this adapter consumes.Scope
Adaptations from ateam source
stratix.*→layerlens.*(BaseAdapter, CaptureConfig,PydanticCompat, MemoryEntry).
STRATIXdocstrings/branding →LayerLens._stratix_tracer,_stratix_human_tracer,_stratix_original) gain_layerlens_*primary names with the
_stratix_*aliases retained as deprecationshims for ateam-era consumers (removed in v2).
requires_pydanticset explicitly toV1_OR_V2— the adapter doesnot import pydantic directly.
EventSinkand a duck-typed agent, sinceHttpEventSinkships in alater milestone.
Blast radius
pip install layerlensinstall set is unchanged. Verifiedby
tests/instrument/test_default_install.py.layerlens.instrumentdoes NOT pull inpyautogen.Verified by
tests/instrument/test_lazy_imports.py::test_layerlens_import_does_not_pull_frameworksand
::test_instrument_import_does_not_pull_frameworks.layerlens.instrument.adapters.frameworks.autogennamespace.Test plan
uv run pytest tests/instrument/adapters/frameworks/test_autogen.py -x→ 13 passed in 2.16s
uv run mypy --strict src/layerlens/instrument/adapters/frameworks/autogen→ Success: no issues found in 6 source files
uv run ruff check src/layerlens/instrument/adapters/frameworks/autogen tests/instrument/adapters/frameworks/test_autogen.py→ All checks passed!
surface (
test_layerlens_import_does_not_pull_frameworks+test_instrument_import_does_not_pull_frameworks+test_default_install)python -m samples.instrument.autogen.main→ runs end-to-end producing 15 events across 8 event types
m-peko) verifies wrap/unwrap parity with ateam sourceLinear
LAY-3400 umbrella (M2 framework fan-out, AutoGen slice).