fix(adapters): require enforcement_mode in four framework adapters - #227
Merged
Merged
Conversation
The LangChain, LlamaIndex, Google ADK and OpenAI Agents adapters defaulted enforcement_mode to "declared". TRACE spec section 4.3 says declared MUST NOT be a default, and any other default claims an evaluation nobody observed (trace-spec#416). Drop the default so the caller states the mode, matching trace-spec#419 for the AGT and sandbox adapters. Omitting the argument now raises TypeError. Value validation is unchanged and "declared" is still accepted when passed. Docstrings, error messages, READMEs and tests are updated, including the LlamaIndex README example the interop suite executes. Signed-off-by: Imran Siddique <imran.siddique@opaque.co> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
The LangChain, LlamaIndex, Google ADK and OpenAI Agents adapters defaulted
enforcement_modetodeclared. TRACE spec section 4.3 (spec/trace-v0.2.md:724) saysdeclared"MUST NOT be a default". Loek's diagnosis in trace-spec#416 covers the other direction: a default ofenforceclaims an evaluation nobody observed. So there is no safe default, and the caller states the mode. This matches trace-spec#419, which did the same for the AGT and sandbox adapters.Omitting the argument now raises
TypeError. Value validation is unchanged, anddeclaredis still accepted when passed. That is the right value for a bare framework run.Files:
integrations/langchain/langchain_to_trace.py,integrations/llamaindex/llamaindex_to_trace.py,integrations/google-adk/google_adk_to_trace.py,integrations/openai-agents/openai_agents_to_trace.py: seven signatures lose= "declared"; docstrings and error messages say the mode is required.declared" sections now say the mode is required, and every example passesenforcement_mode="declared". The LlamaIndex README example is executed bytest_llamaindex_interop.py, so it had to change with the code.test_enforcement_mode_has_no_default(omission raisesTypeError) andtest_declared_is_accepted_when_the_caller_states_it. Helpers and interop callers pass the mode.This breaks callers that relied on the default. These integrations have no changelog and are not published as packages, so there is no version to bump.
Local runs on Windows, Python 3.12, one venv per nox session:
requirements-interop.txt): 13 passed.ruff checkwith the lint workflow's rule set: clean.One thing found on the way, not changed here:
noxfile.pypinsagentrust-trace-tests==0.5.0for the ADK session, andtest_level_zero_conformance[declared]fails there with TR-POL-002 on unmodified main too. CI installs 0.5.1 fromrequirements/sdk-google-adk.txt, where it passes.No overlap with #223, which changes
PolicyEvidenceinpackages/agentrust-trace-adapters.🤖 Generated with Claude Code