Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.16.0
0.17.0
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "arkruntime"
version = "0.16.0"
version = "0.17.0"
description = "Ark runtime SDK for Python"
readme = "README.md"
requires-python = ">=3.8"
Expand Down
2 changes: 2 additions & 0 deletions src/arkruntime/types/session/session_stream_shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ class ManagedAgentsStopReason(_DictCompatModel):
"""

type: str = ""
# Pending input event IDs when type is requires_action.
event_ids: Optional[List[str]] = None


class ManagedAgentsRetryStatus(_DictCompatModel):
Expand Down
39 changes: 39 additions & 0 deletions tests/test_ark_apis_stop_reason_sync.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright (c) 2026 ByteDance Ltd. and/or its affiliates.
# SPDX-License-Identifier: Apache-2.0

"""Synced from ark-apis by vendor-session; exercise the real stream decoder."""

import unittest

from arkruntime.types.session import ManagedAgentsStopReason, decode_session_event


class StreamStopReasonTests(unittest.TestCase):
def test_typed_pending_event_ids(self):
self.assertIn("event_ids", ManagedAgentsStopReason.model_fields)
for kind in ("session.status_idle", "session.thread_status_idle"):
for ids in (["sevt-a", "sevt-b"], ["sevt-b"], []):
payload = {
"type": kind,
"id": "sevt-idle",
"stop_reason": {"type": "requires_action", "event_ids": ids},
}
if kind == "session.thread_status_idle":
payload.update(session_thread_id="sthr-1", agent_name="agent")
with self.subTest(kind=kind, ids=ids):
event = decode_session_event(payload)
self.assertIsInstance(event.stop_reason, ManagedAgentsStopReason)
self.assertEqual(event.stop_reason.event_ids, ids)
self.assertEqual(event.stop_reason["event_ids"], ids)
self.assertEqual(event.model_dump(exclude_unset=True), payload)

def test_legacy_and_future_reasons(self):
for kind in ("end_turn", "retries_exhausted", "future_reason"):
with self.subTest(kind=kind):
reason = ManagedAgentsStopReason(type=kind)
self.assertIsNone(reason.event_ids)
self.assertEqual(reason.model_dump(exclude_unset=True), {"type": kind})


if __name__ == "__main__":
unittest.main()
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading