-
Notifications
You must be signed in to change notification settings - Fork 78
add tool adapters #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add tool adapters #236
Conversation
rayrayraykk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move these test file to tests/tools
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds tool adapters for AutoGen and LangGraph frameworks, updates the AgentScope tool adapter with improved functionality, adds comprehensive unit tests for all three adapters, and updates the documentation with integration examples.
Key Changes:
- Added
LanggraphNodeAdapterfor integrating tools with LangGraph workflows - Added
AutogenToolAdapterandcreate_autogen_toolsfor AutoGen framework integration - Refactored AgentScope adapter from decorator pattern to function-based approach with
agentscope_tool_adapterandagentscope_toolkit_adapter
Reviewed changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated 18 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_langgraph_adapter.py | Comprehensive test suite for LangGraph adapter covering creation, execution, error handling, and graph integration |
| tests/unit/test_autogen_adapter.py | Unit tests for AutoGen adapter including creation, execution, and override functionality |
| tests/unit/test_agentscope_adapter.py | Extensive tests for AgentScope adapter with toolkit creation, execution, and React agent integration |
| src/agentscope_runtime/adapters/langgraph/tool/tool.py | Implementation of LanggraphNodeAdapter extending ToolNode with async execution support |
| src/agentscope_runtime/adapters/langgraph/tool/init.py | Export definitions for LangGraph adapter |
| src/agentscope_runtime/adapters/autogen/tool/tool.py | Implementation of AutogenToolAdapter and helper functions |
| src/agentscope_runtime/adapters/autogen/tool/init.py | Export definitions for AutoGen adapter |
| src/agentscope_runtime/adapters/agentscope/tool/tool.py | Refactored tool adapter with improved error handling and async support |
| src/agentscope_runtime/adapters/agentscope/tool/init.py | Updated exports reflecting new function names |
| cookbook/zh/tools/tools.md | Updated Chinese documentation with new adapter usage and AutoGen examples |
| cookbook/en/tools/tools.md | Updated English documentation with new adapter usage and AutoGen examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
rayrayraykk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an FAQ section to explain the relationship between these out‑of‑the‑box Tools and sandbox environments. These Tools mainly wrap API calls (e.g., ModelStudio Search, RAG, Payments) and do not perform actions that could affect the local system environment — no file I/O, no process control, no privileged commands.
Because of this:
- They do not require sandbox isolation.
- Running them inside a sandbox would only add unnecessary complexity and overhead.
- If sandbox execution is needed for tools that directly interact with local system resources, users should implement and deploy their own sandbox‑compatible Tools.
📖 FAQ
Q: Why can’t or shouldn’t these out‑of‑the‑box Tools run inside a sandbox?
A: Prebuilt Tools (like Search, RAG, AIGC, Payments) are purely API wrappers. Their logic executes on cloud services or third‑party platforms, and the local process only handles network requests. They do not alter system configurations, access local files, or spawn processes.
Sandboxing is meant to isolate potentially risky operations (e.g., running untrusted scripts, executing system commands). Since these Tools conform to production safety requirements, we don’t recommend or support running them within a sandbox.
If your use‑case needs to execute code that could impact the host environment, please follow sandbox integration patterns and create custom Tools designed for sandbox‑enabled engines.
Q: 为什么这些开箱即用的 Tool 不能(或不需要)在沙箱中运行?
A: 预置 Tool(如 Search、RAG、AIGC、Payments 等)本质上是 API 请求的封装,逻辑在云端或第三方服务完成,本地仅发出网络请求,不会修改系统配置、访问本地文件或启动进程。
沙箱的意义在于隔离可能有风险的操作(例如运行未知脚本、执行系统命令),而这些 Tool 已符合生产级安全要求,因此我们不建议也不会在沙箱中支持它们。
如果你的场景需要运行可能影响宿主环境的代码,请参考沙箱适配方式,编写自定义 Tool 并部署到支持沙箱的执行引擎中。
…te_adapter # Conflicts: # pyproject.toml # src/agentscope_runtime/sandbox/box/mobile/adbmcp/tsconfig.build.json
done |
Description
Related Issue: Fixes #[issue_number] or Relates to #[issue_number]
Security Considerations: [If applicable, especially for sandbox changes]
Type of Change
Component(s) Affected
Checklist
Testing
[How to test these changes]
Additional Notes
[Optional: any other context]