Skip to content

Commit f4d366f

Browse files
authored
[Hotfix] Bump version to v1.0.0b2 and fix KeyError when only one tool call message is received (#246)
## Description This PR updates the project version to **v1.0.0b2** and includes a bug fix in the Agentscope message stream adapter: - **Version bump**: - `pyproject.toml` updated from `1.0.0b1` → `1.0.0b2` - `__version__` in `version.py` updated accordingly - **Bug fix – Tool call KeyError**: - In scenarios where only a single tool call message is yielded, the previous implementation could raise a `KeyError` when retrieving from `tool_use_messages_dict`. - Updated logic to use `.get()` and construct a new `PLUGIN_CALL` message when the call ID is missing from the dictionary. - Prevents runtime errors and ensures proper streaming of partial tool call messages. - **Cleanup**: - Removed debug `print` statements from `sandbox_manager.py` for cleaner logs. **Impact:** This improves stability when handling tool use messages in edge cases and prepares the release for **v1.0.0b2**. ## Type of Change - [x] Bug fix - [ ] New feature - [ ] Breaking change - [ ] Documentation - [ ] Refactoring ## Component(s) Affected - [x] Engine - [ ] Sandbox - [ ] Tools - [ ] Common - [ ] Documentation - [ ] Tests - [ ] CI/CD ## Checklist - [x] Pre-commit hooks pass - [x] Tests pass locally - [x] Documentation updated (if needed) - [x] Ready for review
1 parent 4849b60 commit f4d366f

File tree

4 files changed

+37
-8
lines changed

4 files changed

+37
-8
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "agentscope-runtime"
3-
version = "1.0.0b1"
3+
version = "1.0.0b2"
44
description = "A production-ready runtime framework for agent applications, providing secure sandboxed execution environments and scalable deployment solutions with multi-framework support."
55
readme = "README.md"
66
requires-python = ">=3.10"

src/agentscope_runtime/adapters/agentscope/stream.py

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,41 @@ async def adapt_agentscope_message_stream(
252252
call_id = element.get("id")
253253

254254
if last:
255-
plugin_call_message = tool_use_messages_dict[
256-
call_id
257-
]
255+
plugin_call_message = tool_use_messages_dict.get(
256+
call_id,
257+
)
258+
259+
if plugin_call_message is None:
260+
# Only one tool use message yields, we fake
261+
# Build a new tool call message
262+
plugin_call_message = Message(
263+
type=MessageType.PLUGIN_CALL,
264+
role="assistant",
265+
)
266+
267+
data_delta_content = DataContent(
268+
index=index,
269+
data=FunctionCall(
270+
call_id=element.get("id"),
271+
name=element.get("name"),
272+
arguments="",
273+
).model_dump(),
274+
delta=True,
275+
)
276+
277+
plugin_call_message = _update_obj_attrs(
278+
plugin_call_message,
279+
metadata=metadata,
280+
usage=usage,
281+
)
282+
yield plugin_call_message.in_progress()
283+
data_delta_content = (
284+
plugin_call_message.add_delta_content(
285+
new_content=data_delta_content,
286+
)
287+
)
288+
yield data_delta_content
289+
258290
json_str = json.dumps(element.get("input"))
259291
data_delta_content = DataContent(
260292
index=index,

src/agentscope_runtime/sandbox/manager/sandbox_manager.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,6 @@ def create(
460460

461461
config = SandboxRegistry.get_config_by_type(target_sandbox_type)
462462

463-
print(target_sandbox_type)
464-
print(config)
465-
466463
if not config:
467464
logger.warning(
468465
f"Not found sandbox {target_sandbox_type}, " f"using default",

src/agentscope_runtime/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# -*- coding: utf-8 -*-
2-
__version__ = "v1.0.0b1"
2+
__version__ = "v1.0.0b2"

0 commit comments

Comments
 (0)