Conversation
Signed-off-by: Richard Chien <stdrc@outlook.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a new example demonstrating how to create custom tools for Kimi CLI. The example includes a simple Ls tool that lists files in a directory and shows how to integrate custom tools into an agent configuration file.
- Creates a standalone example project with proper dependency management
- Implements a custom
Lstool using theCallableTool2interface - Demonstrates integration of custom tools via agent YAML configuration
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
examples/custom-tools/pyproject.toml |
Defines project dependencies and configuration for the custom tools example |
examples/custom-tools/myagent.yaml |
Agent configuration file that extends the default agent and includes the custom Ls tool |
examples/custom-tools/my_tools/ls.py |
Implementation of a custom Ls tool that lists files in a directory |
examples/custom-tools/my_tools/__init__.py |
Empty init file to make my_tools a Python package |
examples/custom-tools/main.py |
Example script demonstrating how to run the agent with custom tools |
examples/custom-tools/README.md |
Documentation explaining the purpose of the example and how to run it |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| description: str = "List files in a directory." | ||
| params: type[Params] = Params | ||
|
|
||
| async def __call__(self, params: Params) -> ToolReturnValue: |
There was a problem hiding this comment.
The __call__ method should be decorated with @override to follow the codebase convention. All other tool implementations in the codebase use the @override decorator on the __call__ method to explicitly indicate that this method is overriding the parent class method.
| directory: str = Field(description="The directory to list files from.", default=".") | ||
|
|
||
|
|
||
| class Ls(CallableTool2): |
There was a problem hiding this comment.
The CallableTool2 class should be parameterized with the Params type, following the pattern used in all other tools in the codebase. The declaration should be class Ls(CallableTool2[Params]): instead of class Ls(CallableTool2):. This provides better type safety and consistency with the rest of the codebase.
| class Ls(CallableTool2): | |
| class Ls(CallableTool2[Params]): |
| from kosong.tooling import CallableTool2, ToolError, ToolOk, ToolReturnValue | ||
| from pydantic import BaseModel, Field |
There was a problem hiding this comment.
Missing import for override decorator. To use the @override decorator on the __call__ method (as is standard practice in all other tools), add from typing import override to the imports.
No description provided.