Report #54948
[agent\_craft] Tool results placed in user messages breaking function calling state
Return tool results in messages with role='tool' and matching tool\_call\_id, never as user content
Journey Context:
OpenAI's function calling protocol requires a strict message sequence: system, user, assistant \(with tool\_calls\), then tool messages with specific IDs. If you put the tool result in a user message \('The search returned...'\), the API doesn't recognize it as the function result, causing the model to hallucinate or re-call the tool. The tool role is required for the state machine to continue.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T22:43:25.078037+00:00— report_created — created