instrument: base foundation (M1.A port)#93
Closed
mmercuri wants to merge 3 commits into
Closed
Conversation
Bootstraps the LayerLens instrument layer with the abstract base classes,
adapter registry, capture configuration, event sinks, vendored event
schemas, and pydantic v1/v2 compatibility shim that every concrete
adapter (frameworks, protocols, providers) will depend on.
Scope
-----
- src/layerlens/instrument/__init__.py: lean re-export surface
- src/layerlens/instrument/_vendored/: frozen ateam event schemas (no
runtime ateam dependency)
- src/layerlens/instrument/adapters/_base/: BaseAdapter, AdapterRegistry,
AdapterStatus, AdapterHealth, AdapterCapability, ReplayableTrace,
CaptureConfig, EventSink, TraceStoreSink, IngestionPipelineSink,
PydanticCompat
- src/layerlens/_compat/pydantic.py: model_dump/model_validate shim
spanning pydantic v1 + v2
- scripts/{port_adapter,port_protocol,emit_adapter_manifest,
regen_dep_baselines}.py: codegen helpers used to port the rest of M1
- tests/instrument/{test_base_layer,test_lazy_imports,
test_default_install,test_resolved_dep_tree}.py + _baselines/
- .github/workflows/dep-tree-guard.yaml: CI gate that locks the default
install footprint
- docs/adapters/: CONTRIBUTING, STATUS, pydantic-compatibility, testing,
PERSONA_REVIEW
Blast radius
------------
- Pure additions. No public surface changes outside the new
layerlens.instrument namespace.
- Default `pip install layerlens` install set is unchanged (verified by
test_default_install.py against the new baseline).
- Lazy adapter discovery: importing layerlens.instrument MUST NOT pull
in any optional adapter dep (verified by test_lazy_imports.py).
Test plan
---------
- uv run pytest tests/instrument/test_base_layer.py
tests/instrument/test_lazy_imports.py -x -> 45 passed
- The dep-tree-guard workflow exercises test_default_install.py and
test_resolved_dep_tree.py against the new baselines on every PR.
LAY-3400 umbrella: this PR is the prerequisite for the M1.B/M1.C/M1.D
adapter ports, M7 protocol certification, and M8 Cohere/Mistral.
Auto-fixed by 'ruff check --fix'. No behavior change.
Contributor
Author
|
Linear: https://linear.app/layerlens/issue/LAY-3400 (M1 foundation port — base of the 6-PR stack; under Apollo M1 epic LAY-3423). Includes: BaseAdapter + AdapterRegistry + CaptureConfig + EventSink + vendored stratix.* events + Pydantic v1/v2 compat shim (LAY-3401 covered) + dep-tree-guard CI workflow (LAY-3404 partial). |
This was referenced Apr 26, 2026
Ports the twelve agent-tier framework adapters from the ateam
reference implementation onto the new layerlens.instrument base layer:
Semantic Kernel, LlamaIndex, OpenAI Agents, Pydantic-AI, Agno,
Strands, SmolAgents, MS Agent Framework, Google ADK,
Bedrock Agents, Embedding (vector store hooks), Benchmark Import
Pairs with feat/instrument-frameworks-orchestration (M1.C part 1)
which lands LangChain, LangGraph, CrewAI, AutoGen, Langfuse, and
Agentforce. Together they complete M1.C.
Scope
-----
- src/layerlens/instrument/adapters/frameworks/{semantic_kernel,
llama_index,openai_agents,pydantic_ai,agno,strands,smolagents,
ms_agent_framework,google_adk,bedrock_agents,embedding,
benchmark_import}/: per-framework packages
- tests/instrument/adapters/frameworks/test_*_adapter.py + the
test_bulk_ported_smoke.py harness (which exercises every ported
adapter against canned trace fixtures so partial framework SDKs
on a given runner don't drop coverage to zero)
- samples/instrument/<framework>/: runnable per-framework samples
- docs/adapters/frameworks-<framework>.md: per-framework integration
guide
- pyproject.toml: twelve new optional extras
(semantic-kernel, llama-index, openai-agents, pydantic-ai, agno,
strands, smolagents, ms-agent-framework, google-adk,
bedrock-agents, embedding, benchmark-import) with python_version
markers; pyright/ruff exclusions for the dynamic monkey-patching
framework code
Blast radius
------------
- Default `pip install layerlens` install set is unchanged. Each
framework's heavy deps are gated behind their own extra.
- No changes to existing public API surface.
- Importing layerlens.instrument still does NOT pull in any framework
module (lazy registry lookup).
Test plan
---------
- uv run pytest tests/instrument/adapters/frameworks/ -x ->
184 passed, 1 skipped (test_bulk_ported_smoke.py covers all 12
agent-tier adapters plus the orchestration-tier ones from part 1
via the same harness)
Stacks on
---------
- feat/instrument-base-foundation (M1.A) — required for the
BaseAdapter surface this PR consumes.
Sibling of
----------
- feat/instrument-frameworks-orchestration (M1.C part 1) — both
branches stack on the base foundation independently and don't
conflict; they can land in either order.
LAY-3400 umbrella (M1.C part 2).
Co-authored-by: mmercuri <marc@giantdigital.io>
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
Bootstraps the LayerLens instrument layer: abstract
BaseAdapter,AdapterRegistry,CaptureConfig,EventSink, vendored ateam eventschemas, and a pydantic v1/v2 compatibility shim. Every concrete
adapter (frameworks, protocols, providers) in the M1 port depends on
this PR, so it merges first.
Scope
src/layerlens/instrument/__init__.py— lean re-export surfacesrc/layerlens/instrument/_vendored/— frozen ateam event schemas(no runtime ateam dependency)
src/layerlens/instrument/adapters/_base/—BaseAdapter,AdapterRegistry,AdapterStatus,AdapterHealth,AdapterCapability,ReplayableTrace,CaptureConfig,EventSink,TraceStoreSink,IngestionPipelineSink,PydanticCompatsrc/layerlens/_compat/pydantic.py—model_dump/model_validateshim spanning pydantic v1 + v2
scripts/{port_adapter,port_protocol,emit_adapter_manifest,regen_dep_baselines}.py— codegen helpers used to port the rest of M1
tests/instrument/{test_base_layer,test_lazy_imports,test_default_install,test_resolved_dep_tree}.py_baselines/.github/workflows/dep-tree-guard.yaml— CI gate that locks thedefault install footprint
docs/adapters/— CONTRIBUTING, STATUS, pydantic-compatibility,testing, PERSONA_REVIEW
Blast radius
layerlens.instrumentnamespace.pip install layerlensinstall set is unchanged (verified bytest_default_install.pyagainst the new baseline).layerlens.instrumentMUST NOTpull in any optional adapter dep (verified by
test_lazy_imports.py).Test plan
uv run pytest tests/instrument/test_base_layer.py tests/instrument/test_lazy_imports.py -x— 45 passed locallytest_default_install.pyandtest_resolved_dep_tree.pyagainst the new baselines on PRm-peko) sanity-check on adapter base contractsLinear
LAY-3400 umbrella (M1 port). This PR is the prerequisite for the
M1.B / M1.C / M1.D adapter ports, M7 protocol certification, and M8
Cohere/Mistral.