Octoroom.Agent.Processors.Context (octoroom_agents v0.1.0)

Copy Markdown View Source

The only owner of the conversation history.

Inputs:

  • Transcription with a new turn_id - a user turn: the history gets it (after its annotation, if any, labelled [speaker] when it has one) and an LLMContext goes downstream, unless it has respond: false
  • UserAudio - a user turn heard as audio (half-cascaded); its conversation item is reserved until the transcript arrives
  • Transcription for an audio turn - replaces that turn's audio with text, so later requests don't resend it
  • ToolResults (upstream) - the next tool round, up to max_tool_rounds; after that the LLM answers without tools
  • AssistantMessage (upstream) - the reply, finished or interrupted. It comes once its audio has played, so it takes the place in the history that its turn reserved: turns heard while it played come after it. An interrupted reply holds only what was heard, and ends in … [interrupted] so the LLM knows it was cut off.
  • AsyncToolResult (upstream) - a non-blocking tool's result: noted silently, or a new turn about it
  • Prompt - a turn from the app (Octoroom.Agent.prompt/3), marked as not said by anyone on the call
  • Start - after initial_delay_ms, the agent's initial_text starts a turn

It also emits the owner's conversation events (Octoroom.Agent.ConversationEvents), and sends the owner {:voice_pipeline, pid, {:memory, memory}} whenever what's worth keeping changes: %{history: messages, conversation: %{id, sequence}}, the history without replies still to come or turns still audio. The worker saves it, and a context started with saved: (in its runner context) carries on from it.

Options (each defaults to the runner context's value): :instructions, :initial_text, :tools; plus :max_tool_rounds (4), :max_history (20), :initial_delay_ms (100).