Module: AgUi::Messages
- Defined in:
- lib/ag_ui/messages.rb
Overview
Translates AG-UI wire messages (RunAgentInput.messages — raw camelCase hashes) into brute's canonical Brute::Message log, ready for the turn pipeline. This is where client-executed tool results re-enter the conversation: the assistant's toolCalls and the matching tool messages must round-trip faithfully or the model repeats calls (doc 03 gotchas).
Class Method Summary collapse
Class Method Details
.to_brute(wire_messages) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ag_ui/messages.rb', line 14 def to_brute() log = Brute.log .each do || case ["role"] in "user" log.user(text_content(["content"])) in "assistant" log << () in "tool" log.tool(["content"].to_s, tool_call_id: ["toolCallId"]) in "system" | "developer" log.system(["content"].to_s) in "activity" | "reasoning" # Not part of the LLM conversation: activities render client-side # (phase 4) and reasoning is provider-managed (phase 5). nil end end log end |