Skip to content

LocalSkillsTool

autogen.beta.tools.local_skills.tool.LocalSkillsTool #

LocalSkillsTool(runtime=None)

Bases: Toolkit

Client-side skills toolkit using the agentskills.io convention.

Implements a three-step progressive-disclosure pattern:

  1. list_skills() — returns a lightweight catalog (name + description).
  2. load_skill(name) — returns the full SKILL.md instructions on demand.
  3. run_skill_script(name, script, args) — executes a script from the skill's scripts/ directory.

Works with any provider (no provider-specific API required).

Example::

# Default runtime (.agents/skills + ~/.agents/skills)
LocalSkillsTool()

# Custom install directory
LocalSkillsTool(runtime=LocalRuntime("./skills"))

# Additional read-only search paths
LocalSkillsTool(runtime=LocalRuntime("./skills", extra_paths=["./shared-skills"]))
Source code in autogen/beta/tools/local_skills/tool.py
def __init__(
    self,
    runtime: SkillRuntime | None = None,
) -> None:
    _runtime: SkillRuntime = runtime if runtime is not None else LocalRuntime()

    self.list_skills = _make_list_tool(_runtime)
    self.load_skill = _make_load_tool(_runtime)
    self.run_skill_script = _make_run_tool(_runtime)

    super().__init__(self.list_skills, self.load_skill, self.run_skill_script)

list_skills instance-attribute #

list_skills = _make_list_tool(_runtime)

load_skill instance-attribute #

load_skill = _make_load_tool(_runtime)

run_skill_script instance-attribute #

run_skill_script = _make_run_tool(_runtime)

tools instance-attribute #

tools = [(with_middleware(*(_middleware))) for t in tools]

schemas async #

schemas(context)
Source code in autogen/beta/tools/final/toolkit.py
async def schemas(self, context: "Context") -> Iterable[ToolSchema]:
    schemas: list[ToolSchema] = []
    for t in self.tools:
        schemas.extend(await t.schemas(context))
    return schemas

register #

register(stack, context, *, middleware=())
Source code in autogen/beta/tools/final/toolkit.py
def register(
    self,
    stack: "ExitStack",
    context: "Context",
    *,
    middleware: Iterable["BaseMiddleware"] = (),
) -> None:
    for t in self.tools:
        t.register(stack, context, middleware=middleware)

tool #

tool(function: Callable[..., Any], *, name: str | None = None, description: str | None = None, schema: FunctionParameters | None = None, sync_to_thread: bool = True, middleware: Iterable[ToolMiddleware] = ()) -> FunctionTool
tool(function: None = None, *, name: str | None = None, description: str | None = None, schema: FunctionParameters | None = None, sync_to_thread: bool = True, middleware: Iterable[ToolMiddleware] = ()) -> Callable[[Callable[..., Any]], FunctionTool]
tool(function=None, *, name=None, description=None, schema=None, sync_to_thread=True, middleware=())
Source code in autogen/beta/tools/final/toolkit.py
def tool(
    self,
    function: Callable[..., Any] | None = None,
    *,
    name: str | None = None,
    description: str | None = None,
    schema: FunctionParameters | None = None,
    sync_to_thread: bool = True,
    middleware: Iterable[ToolMiddleware] = (),
) -> FunctionTool | Callable[[Callable[..., Any]], FunctionTool]:
    def make_tool(f: Callable[..., Any]) -> FunctionTool:
        t = FunctionTool.ensure_tool(
            tool(
                f,
                name=name,
                description=description,
                schema=schema,
                sync_to_thread=sync_to_thread,
                middleware=middleware,
            )
        ).with_middleware(*self._middleware)
        self.tools.append(t)
        return t

    if function:
        return make_tool(function)

    return make_tool