Skip to content

SkillsTool

autogen.beta.tools.builtin.skills.SkillsTool #

SkillsTool(*skills)

Bases: Tool

Declares provider-side skills to be activated for this agent.

Accepts skill identifiers as plain strings (shorthand for the latest version) or :class:Skill objects when a specific version is required.

Example::

# Strings — shorthand for Skill(id=s, version=None)
SkillsTool("pptx", "xlsx")

# Mix
SkillsTool("pptx", Skill("xlsx", version="latest"))
Source code in autogen/beta/tools/builtin/skills.py
def __init__(self, *skills: str | Skill) -> None:
    self._skills: list[Skill] = [s if isinstance(s, Skill) else Skill(id=s) for s in skills]
    self.name = SKILLS_TOOL_NAME

name instance-attribute #

name = SKILLS_TOOL_NAME

schemas async #

schemas(context)
Source code in autogen/beta/tools/builtin/skills.py
async def schemas(self, context: "Context") -> list[SkillsToolSchema]:
    return [SkillsToolSchema(skills=list(self._skills))]

register #

register(stack, context, *, middleware=())
Source code in autogen/beta/tools/builtin/skills.py
def register(
    self,
    stack: "ExitStack | AsyncExitStack",
    context: "Context",
    *,
    middleware: Iterable["BaseMiddleware"] = (),
) -> None:
    async def execute(event: "ToolCallEvent", context: "Context") -> None:
        pass

    stack.enter_context(
        context.stream.where(BuiltinToolCallEvent.name == SKILLS_TOOL_NAME).sub_scope(execute),
    )

set_provider #

set_provider(provider)
Source code in autogen/beta/tools/tool.py
def set_provider(self, provider: Provider) -> None:
    pass