Skip to content

Commit 3bbbd31

Browse files
refactor: use ToolResult.get_serialized_output() for context messages
Use the new get_serialized_output() method from amplifier-core to properly serialize tool results for LLM context. This ensures structured outputs (like bash tool's stdout/stderr/returncode dict) are JSON- serialized rather than using Python repr format. 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
1 parent 774d036 commit 3bbbd31

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

amplifier_module_loop_basic/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,8 @@ async def execute_single_tool(tc: Any, group_id: str) -> tuple[str, str]:
310310
if coordinator:
311311
await coordinator.process_hook_result(post_result, "tool:post", tool_name)
312312

313-
# Return success with result content
314-
result_content = str(
315-
getattr(result, "data", None) or getattr(result, "text", None) or result
316-
)
313+
# Return success with result content (JSON-serialized for dict/list)
314+
result_content = result.get_serialized_output()
317315
return (tool_call_id, result_content)
318316

319317
except Exception as te:

0 commit comments

Comments
 (0)