Bases: Tool
Provider-neutral code execution capability.
Each LLM client's mapper is responsible for converting this schema into the correct provider-specific API format.
Source code in autogen/beta/tools/builtin/code_execution.py
| def __init__(
self,
*,
version: CodeExecutionVersions = "code_execution_20250825",
) -> None:
self._schema = CodeExecutionToolSchema(version=version)
self.name = CODE_EXECUTION_TOOL_NAME
|
name = CODE_EXECUTION_TOOL_NAME
Source code in autogen/beta/tools/builtin/code_execution.py
| async def schemas(self, context: "Context") -> list[ToolSchema]:
return [self._schema]
|
register(stack, context, *, middleware=())
Source code in autogen/beta/tools/builtin/code_execution.py
| def register(
self,
stack: "ExitStack",
context: "Context",
*,
middleware: Iterable["BaseMiddleware"] = (),
) -> None:
async def execute(event: "ToolCallEvent", context: "Context") -> None:
pass
stack.enter_context(
context.stream.where(BuiltinToolCallEvent.name == CODE_EXECUTION_TOOL_NAME).sub_scope(execute),
)
|
Source code in autogen/beta/tools/tool.py
| def set_provider(self, provider: Provider) -> None:
pass
|