Class: Assistant::AssemblyAgent

Inherits:
RubyLLM::Agent
  • Object
show all
Defined in:
app/agents/assistant/assembly_agent.rb

Overview

Synthesizes the user-facing reply from completed plan step summaries.
No tools — context only. Fresh chat per assembly call.

See Also:

  • PlanOrchestrator#assemble_plan_response

Constant Summary collapse

ORIGINAL_MESSAGE_LIMIT =

How much of the original request reaches the agent. The block is labelled
"the source of truth for IDs/URLs/slugs", so cutting it short defeats its
only purpose — and a turn whose prompt CARRIES its answer loses that
answer entirely.

It was 2000. A Daily Focus prompt is ~16,300 characters with a
precomputed 20-row coverage table starting at character 2,919, so the
agent read the instruction "the table below IS Section 1, reproduce every
row verbatim" and then zero rows of it. It wrote Section 1 as prose
instead. Invisible until a rep noticed the timeline had gone.

(Only exposed once PlanToolBuilder stopped keeping the model's own
write-up step — that step agent saw the whole prompt, so the truncation
never showed.)

Sized to clear the longest prompt we generate with headroom. Step results
beside it already get 3000 each and there can be a dozen, so this is not
the expensive part of the assembly context.

24_000