Op agent: preserve tool-call protocol

t-404·WorkTask·
·
·
Created1 month ago·Updated1 month ago

Description

Edit

Fix tool-call protocol preservation in Op agent loop.

Problem

Op agent currently collapses tool calls/results into text:

  • Tool results are appended as PromptMessage "tool" (tshow result)
  • Provider messages always set msgToolCalls/msgToolCallId to Nothing

This loses structured tool call semantics and can break providers that require tool_call_id or structured tool response messages.

Requirements

  • Preserve tool_call_id, tool_calls structure across Op -> Provider -> Op
  • Ensure tool response messages include correct tool_call_id and content
  • Keep backward compatibility with current tools

Implementation Ideas

  • Extend Op.PromptMessage to carry optional tool metadata
  • Map tool calls into Provider.msgToolCalls
  • Map tool results into Provider.msgToolCallId + content

Acceptance

  • Tool-using prompts work with providers that require tool_call_id
  • Trace shows tool calls/results with proper ids

Timeline (3)

🔄[human]Open → Done1 month ago
💬[human]1 month ago

Extended Op.PromptMessage with tool metadata, preserved tool_call_id/tool_calls through Provider messages, and added tool message encoding + docs update.