Skip to content

fix(adapters): require enforcement_mode in four framework adapters - #227

Merged
imran-siddique merged 1 commit into
mainfrom
fix/require-enforcement-mode
Sep 26, 2026
Merged

imran-siddique merged 1 commit into
mainfrom
fix/require-enforcement-mode

Conversation

@imran-siddique

Copy link
Copy Markdown
Member

The LangChain, LlamaIndex, Google ADK and OpenAI Agents adapters defaulted enforcement_mode to declared. TRACE spec section 4.3 (spec/trace-v0.2.md:724) says declared "MUST NOT be a default". Loek's diagnosis in trace-spec#416 covers the other direction: a default of enforce claims 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, and declared is 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.
  • The four READMEs: the "defaults to declared" sections now say the mode is required, and every example passes enforcement_mode="declared". The LlamaIndex README example is executed by test_llamaindex_interop.py, so it had to change with the code.
  • Tests: each adapter gets test_enforcement_mode_has_no_default (omission raises TypeError) and test_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:

  • Unit suites for the four adapters plus otel-genai: 142 passed.
  • LangGraph interop (langchain-core 1.6.0, langgraph 1.2.11): 1 passed.
  • LlamaIndex interop (requirements-interop.txt): 13 passed.
  • OpenAI Agents (agentrust-trace 0.9.0, openai-agents 0.22.0): 30 passed.
  • Google ADK (agentrust-trace 0.9.0, google-adk 2.9.1, agentrust-trace-tests 0.5.1): 40 passed.
  • ruff check with the lint workflow's rule set: clean.

One thing found on the way, not changed here: noxfile.py pins agentrust-trace-tests==0.5.0 for the ADK session, and test_level_zero_conformance[declared] fails there with TR-POL-002 on unmodified main too. CI installs 0.5.1 from requirements/sdk-google-adk.txt, where it passes.

No overlap with #223, which changes PolicyEvidence in packages/agentrust-trace-adapters.

🤖 Generated with Claude Code

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>
@imran-siddique
imran-siddique requested review from a team and carloshvp as code owners September 26, 2026 03:36
@imran-siddique
imran-siddique merged commit cc0e659 into main Sep 26, 2026
21 checks passed
@imran-siddique
imran-siddique deleted the fix/require-enforcement-mode branch September 26, 2026 03:41
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.

1 participant