Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions python/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

## Unreleased

## 0.0.4 (2026-02-08)
- Dependencies: Update kimi-cli to version 1.9, kosong to version 0.42
- API: Re-export `TurnEnd`, `ShellDisplayBlock`, `TodoDisplayItem`, and `SystemPromptTemplateError`

## 0.0.3 (2026-01-21)
- Docs: expand Python SDK guides (QuickStart, Prompt/Session, tools)
- Examples: add Python examples to demonstrate SDK features
Expand Down
6 changes: 3 additions & 3 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "kimi-agent-sdk"
version = "0.0.3"
version = "0.0.4"
description = "A Python SDK for Kimi Agent (Kimi CLI)."
readme = "README.md"
requires-python = ">=3.12"
Expand All @@ -19,8 +19,8 @@ classifiers = [
"License :: OSI Approved :: Apache Software License",
]
dependencies = [
"kimi-cli>=0.83,<0.84",
"kosong>=0.39.0,<0.40.0",
"kimi-cli>=1.9.0,<1.10.0",
"kosong>=0.42.0,<0.43.0",
]

[project.urls]
Expand Down
8 changes: 8 additions & 0 deletions python/src/kimi_agent_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ async def main() -> None:
KimiCLIException,
MCPConfigError,
MCPRuntimeError,
SystemPromptTemplateError,
)
from kimi_cli.soul import LLMNotSet, LLMNotSupported, MaxStepsReached, RunCancelled
from kimi_cli.wire.types import (
Expand All @@ -83,15 +84,18 @@ async def main() -> None:
DisplayBlock,
Event,
Request,
ShellDisplayBlock,
StatusUpdate,
StepBegin,
StepInterrupted,
SubagentEvent,
TodoDisplayBlock,
TodoDisplayItem,
TokenUsage,
ToolCallPart,
ToolResult,
TurnBegin,
TurnEnd,
WireMessage,
is_event,
is_request,
Expand Down Expand Up @@ -141,6 +145,7 @@ async def main() -> None:
"Event",
"Request",
"TurnBegin",
"TurnEnd",
"StepBegin",
"StepInterrupted",
"CompactionBegin",
Expand All @@ -154,7 +159,9 @@ async def main() -> None:
"DisplayBlock",
"BriefDisplayBlock",
"DiffDisplayBlock",
"ShellDisplayBlock",
"TodoDisplayBlock",
"TodoDisplayItem",
"TokenUsage",
"is_event",
"is_request",
Expand All @@ -168,6 +175,7 @@ async def main() -> None:
"InvalidToolError",
"MCPConfigError",
"MCPRuntimeError",
"SystemPromptTemplateError",
"LLMNotSet",
"LLMNotSupported",
"ChatProviderError",
Expand Down
12 changes: 11 additions & 1 deletion python/tests/test_aggregator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from kimi_cli.wire.types import StepBegin
from kimi_cli.wire.types import StepBegin, TurnEnd
from kosong.message import TextPart, ToolCall
from kosong.tooling import ToolOk, ToolResult

Expand Down Expand Up @@ -28,6 +28,16 @@ def test_aggregator_flushes_step_with_tool_results() -> None:
assert messages[1].tool_call_id == "call-1"


def test_aggregator_ignores_turn_end() -> None:
agg = MessageAggregator()
agg.feed(TextPart(text="hello"))
assert agg.feed(TurnEnd()) == []

messages = agg.flush()
assert len(messages) == 1
assert messages[0].extract_text() == "hello"


def test_aggregator_final_only_returns_last_step() -> None:
agg = MessageAggregator(final_message_only=True)
agg.feed(TextPart(text="first"))
Expand Down
19 changes: 19 additions & 0 deletions python/tests/test_customized_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

import pytest
from kaos.path import KaosPath
from kimi_cli.exception import SystemPromptTemplateError as CliSystemPromptTemplateError
from kimi_cli.tools.display import ShellDisplayBlock as CliShellDisplayBlock
from kimi_cli.tools.display import TodoDisplayItem as CliTodoDisplayItem
from kimi_cli.wire.types import TurnEnd as CliTurnEnd
from kosong.tooling import (
CallableTool2 as KosongCallableTool2,
)
Expand All @@ -25,9 +29,13 @@
CallableTool2,
Config,
Session,
ShellDisplayBlock,
SystemPromptTemplateError,
TodoDisplayItem,
ToolError,
ToolOk,
ToolReturnValue,
TurnEnd,
)


Expand All @@ -38,6 +46,17 @@ def test_tooling_exports_match_kosong() -> None:
assert ToolReturnValue is KosongToolReturnValue


def test_wire_type_exports_match_sources() -> None:
assert TurnEnd is CliTurnEnd
assert ShellDisplayBlock is CliShellDisplayBlock
assert TodoDisplayItem is CliTodoDisplayItem


def test_system_prompt_template_error_is_kimi_exception() -> None:
assert SystemPromptTemplateError is CliSystemPromptTemplateError
assert issubclass(SystemPromptTemplateError, (ValueError, Exception))


def test_custom_tool_uses_sdk_exports() -> None:
class Params(BaseModel):
directory: str = Field(default=".")
Expand Down
Loading