跳到正文
cccskills
免费在 GitHub 公开

tool

Guide for creating tools using CallableTool2 and Params pattern, plus YAML agent registration

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(2)

  • SKILL.md2.7 KB
  • references/guide.md10.9 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Tool Development Guide

Create custom tools with the CallableTool2 + Params pattern, then register them in a YAML agent file.

Quick Template

"""Brief description of what this tool does."""
from kimi_agent_sdk import CallableTool2, ToolError, ToolOk, ToolReturnValue

class Params(BaseModel):
    """Define tool parameters here."""
    required_param: str = Field(
        description="Description of this parameter for the LLM."
    )
    optional_param: str | None = Field(
        default=None,
        description="Optional parameter with default value."
    )

class MyTool(CallableTool2):
    name: str = "MyTool" # Tool identifier
    description: str = "What this tool does."  # For LLM to understand usage
    params: type[Params] = Params # Link to Params class

    async def __call__(self, params: Params) -> ToolReturnValue:
        """Execute the tool logic."""
        try:
            # Your tool logic here
            result = f"Processed: {params.required_param}"
            return ToolOk(output=result)
        except Exception as e:
            return ToolError(
                message=str(e),
                output="Partial output if available",
                brief="Short error summary"
            )

Key Patterns

  • Return values: ToolOk(output=...) on success; ToolError(message=..., output=..., brief=...) on failure.
  • Validators: ge/le/gt/lt (numeric), min_length/max_length/pattern (strings/collections), default_factory for mutable defaults.
  • Best practices: type hints everywhere; clear Field(description=...); always async __call__; handle exceptions → ToolError; one tool = one job.

Registration

Every new tool must be registered in a YAML agent file as "module.path:ClassName" under tools:. KimiToolset.load_tools() splits on the last :, imports the module, gets the class, instantiates, and adds it. Agent files: agent_worker.json (default), agent_boss.json, agent_subagent.json; base agents in kimi-cli/src/kimi_cli/agents/default/ (agent.yaml, coder.yaml, explore.yaml, plan.yaml). Child YAML tools: replaces the parent's list; use allowed_tools:/exclude_tools: to restrict. Use kimi_cli.tools.* prefix for new tools under kimi-cli/src/kimi_cli/tools/; the relocated shell / process / background-job infra (bash, pwsh, Run, FindStr, job_output, common, security, prompt_common) lives under kimi-cli/src/kimi_cli/tools/ and must be imported as kimi_cli.tools.*.

Full complete example, Params reference, background-task tools, interactive-session reuse, and YAML details: read references/guide.md.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

app

免费

Guide for the Kimix web frontend (src/app/) — vanilla TypeScript + Vite, SSE-based chat UI mirroring sse_cli.py. Use when modifying the frontend, adding new UI features, changing the API client, or understanding the message rendering pipeline.

中文简介正在准备中。当前显示原文说明。

Sikao-Engine/KimiX1142026年10月18日 更新

doc

免费

Guide for navigating and maintaining Kimix project documentation. Use when: (1) user asks about the docs structure, (2) user wants to add, update, or append content to project documents.

中文简介正在准备中。当前显示原文说明。

Sikao-Engine/KimiX1142026年10月18日 更新

kimix_api

免费

Guide for using KimiX API utilities covering kimix, kimix.utils, kimix.base, kimix.dag, kimix.network, kimix.server, kimix.parser, kimix.cot, kimix.retrieval, kimix.summarize, and kimi_agent_sdk.

中文简介正在准备中。当前显示原文说明。

Sikao-Engine/KimiX1142026年10月18日 更新

Guide for Kimix opencode-style HTTP server (FastAPI + SSE), including route definitions, builtin endpoints, and app.post usage.

中文简介正在准备中。当前显示原文说明。

Sikao-Engine/KimiX1142026年10月18日 更新

serve

免费

Guide for the Kimix HTTP serve system — FastAPI backend + TypeScript/Vite frontend. Use when adding new backend endpoints, modifying the session manager, changing the frontend API client, or understanding how data flows from backend to UI. Covers dummy_app.py, dummy_session_manager.py, sse_cli.py, and src/app/.

中文简介正在准备中。当前显示原文说明。

Sikao-Engine/KimiX1142026年10月18日 更新

Guide for creating effective skills. Use when users want to create or update a skill that extends agent's capabilities.

中文简介正在准备中。当前显示原文说明。

Sikao-Engine/KimiX1142026年10月18日 更新

查看 Sikao-Engine 的全部技能

报告此技能的问题