Add Python customized tools guide, example, and SDK tool re-exports#26
Merged
Add Python customized tools guide, example, and SDK tool re-exports#26
Conversation
Collaborator
RealKai42
commented
Jan 21, 2026
- Add guides/python/customized-tools.md with a full custom tool walkthrough and SDK-based imports.
- Add a runnable examples/python/customized-tools sample with agent file, tool module, and entrypoint.
- Re-export CallableTool2, ToolOk, ToolError, ToolReturnValue from the Python SDK and update docs/examples to use them.
- Add python/tests/test_customized_tools.py to verify agent loading of a custom tool.
- Link the agent file docs from guides/python/prompt.md and guides/python/session.md.
There was a problem hiding this comment.
Pull request overview
This pull request adds comprehensive support for custom tools in the Python SDK by re-exporting tool-related classes from the underlying kosong.tooling module and providing complete documentation and examples. The PR enables SDK users to define custom tools using the same approach as Kimi CLI.
Changes:
- Re-exported
CallableTool2,ToolOk,ToolError, andToolReturnValuefromkosong.toolingin the SDK's public API - Added a complete guide at
guides/python/customized-tools.mdwith step-by-step instructions for creating custom tools - Created a runnable example in
examples/python/customized-tools/demonstrating custom tool implementation - Added tests to verify the tool exports and agent file loading functionality
- Updated
prompt.mdandsession.mdto link to the Custom Agent Files documentation
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| python/src/kimi_agent_sdk/init.py | Re-exports CallableTool2, ToolOk, ToolError from kosong.tooling and moves ToolReturnValue import source |
| python/tests/test_customized_tools.py | Tests verifying tool exports match kosong and custom tool loading via agent files |
| guides/python/customized-tools.md | Comprehensive guide for implementing and registering custom tools |
| guides/python/prompt.md | Added link to Custom Agent Files documentation for agent_file parameter |
| guides/python/session.md | Added link to Custom Agent Files documentation for agent_file parameter |
| guides/python/quickstart.md | Added "What's Next" section linking to guides including customized-tools |
| examples/python/customized-tools/* | Complete runnable example with custom Ls tool, agent file, and entrypoint |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.