CodesnipToolkit
https://github.com/bytedance/SandboxFusion https://bytedance.github.io/SandboxFusion/docs/docs/get-started
CodesnipToolkit
Bases: AsyncBaseToolkit
Source code in utu/tools/codesnip_toolkit.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
run_code
async
run_code(code: str, language: str = 'python') -> str
Run code in sandbox and return the result. Supported languages: python, cpp, nodejs, go, go_test, java, php, csharp, bash, typescript, sql, rust, cuda, lua, R, perl, D_ut, ruby, scala, julia, pttest, junit, kotlin_script, jest, verilog, python_gpu, lean, swift, racket
Parameters:
Name | Type | Description | Default |
---|---|---|---|
code
|
str
|
The code to run. |
required |
language
|
str
|
The language of the code. Defaults to "python". |
'python'
|
Returns: str: The result of the code.
Source code in utu/tools/codesnip_toolkit.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|
get_tools_map_func
async
get_tools_map_func() -> dict[str, Callable]
Get tools map. It will filter tools by config.activated_tools if it is not None.
Source code in utu/tools/base.py
58 59 60 61 62 63 64 65 66 67 68 69 |
|
get_tools_in_agents
async
get_tools_in_agents() -> list[FunctionTool]
Get tools in openai-agents format.
Source code in utu/tools/base.py
71 72 73 74 75 76 77 78 79 80 81 82 |
|
get_tools_in_openai
async
get_tools_in_openai() -> list[dict]
Get tools in OpenAI format.
Source code in utu/tools/base.py
84 85 86 87 |
|
get_tools_in_mcp
async
get_tools_in_mcp() -> list[Tool]
Get tools in MCP format.
Source code in utu/tools/base.py
89 90 91 92 |
|
call_tool
async
call_tool(name: str, arguments: dict) -> str
Call a tool by its name.
Source code in utu/tools/base.py
94 95 96 97 98 99 100 |
|