[AAASM-3539] ✨ (adapters): Add Smolagents framework adapter#161
Merged
Conversation
smolagents routes every tool execution (ToolCallingAgent and CodeAgent paths) through smolagents.tools.Tool.__call__ -> self.forward, so wrapping __call__ is the single chokepoint to govern tool name + args before the body runs. Reuses the CrewAI decision plumbing; fail-closed under enforce. Refs AAASM-3539 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Implements the FrameworkAdapter contract for smolagents: framework name, supported range >=1.0.0,<2.0.0 (the 1.x Tool.__call__ chokepoint), and register/unregister delegating to SmolagentsPatch. Refs AAASM-3539 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds the smolagents priority (6, before the MCP fallback) and wires the adapter into the builtin registry so init_assembly() auto-detects it. Refs AAASM-3539 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dev/test-only (NOT a runtime dependency). Installing smolagents lets the importorskip-guarded adapter tests drive a real Tool subclass, so a regression to a fail-open no-op patch is caught instead of silently skipped (AAASM-3528 lesson). Refs AAASM-3539 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Covers apply/revert idempotency, deny blocks the tool body, allow runs + records, sanitize-flag exclusion, dict-positional arg flattening, the adapter contract, and a no-op negative control that fails if the patch is ever reduced to a no-op. Refs AAASM-3539 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drives a genuine smolagents.Tool subclass through Tool.__call__ exactly as the agent runner does: deny blocks forward(), allow runs + records. Includes a post-revert negative control proving the interception is real, not no-op. Refs AAASM-3539 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Refs AAASM-3539 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds the smolagents row to the README and the authoritative Python framework-compatibility matrix (range >=1.0.0,<2.0.0, tested 1.26.x). Refs AAASM-3539 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
Author
|
Claude Code — review result ✅ Real CI green (SonarCloud not blocking).
Ready to merge. Merge before examples #150 + a python-sdk release. Full cross-repo review on AAASM-3535. |
Resolve the registry + README overlaps after py #160 (Haystack) merged: keep both the Haystack (now on master) and Smolagents registry entries, adapter imports, builtin-list entries, and the combined README adapter list. frameworks.md auto-merged (both rows present). Co-Authored-By: Claude Opus 4.8 (1M context) <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.



Description
Adds full Python SDK governance support for Smolagents (Hugging Face; pip
smolagents).The hook point is
smolagents.tools.Tool.__call__— the single chokepoint every tool execution flows through. Both agent paths reach it:ToolCallingAgentviaMultiStepAgent.execute_tool_call(tool(...)), andCodeAgentvia the sandbox namespace (tools are plain callables, dispatching toTool.__call__).__call__runsself.forward(*args, **kwargs), so wrapping it lets governance observe the tool name + arguments and decide before the body runs.This is genuine governance, not a no-op (AAASM-3528 lesson): a
denyverdict short-circuits beforeforward()executes (fail-closed underenforce), andallowruns the tool then records the result. The plumbing (_normalize_decision, fail-closed posture, block/approval messages, pending-approval flow) is reused from the proven CrewAI adapter.Type of Change
Breaking Changes
Related Issues
Testing
test/unit/adapters/smolagents/(apply/revert idempotency, deny blocks body, allow runs+records, sanitize-flag exclusion, dict-positional arg flattening, adapter contract, no-op negative control).test/integration/smolagents/test_real_tool_governance.pydrives a genuinesmolagents.Toolsubclass: deny blocksforward(), allow runs+records, plus a post-revert negative control proving the interception is real.smolagents>=1.0.0,<2.0.0added to thetestdependency group so CI exercises the real framework instead of skipping.pytest(302 adapter tests pass incl. the real-framework smoke),ruff check(new files clean),mypy agent_assembly(clean), fullpre-commit run(isort/autoflake/black/mypy) green.Checklist
docs/compatibility/frameworks.md)🤖 Generated with Claude Code