Skip to content

Add Python customized tools guide, example, and SDK tool re-exports#26

Merged
RealKai42 merged 4 commits intomainfrom
kaiyi/python/customized-tool-doc
Jan 21, 2026
Merged

Add Python customized tools guide, example, and SDK tool re-exports#26
RealKai42 merged 4 commits intomainfrom
kaiyi/python/customized-tool-doc

Conversation

@RealKai42
Copy link
Collaborator

  • 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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and ToolReturnValue from kosong.tooling in the SDK's public API
  • Added a complete guide at guides/python/customized-tools.md with 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.md and session.md to 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.

@RealKai42 RealKai42 merged commit 8c42330 into main Jan 21, 2026
5 checks passed
@RealKai42 RealKai42 deleted the kaiyi/python/customized-tool-doc branch January 21, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants