Skip to main content

Module queue

Module queue 

Source
Expand description

Mirrors the queue portion of packages/agent/src/agent.ts (PendingMessageQueue) + the QueueMode type from packages/agent/src/types.ts.

The agent loop has two drain points:

  • steering: fired mid-run after a turn’s tool batch settles (before the next LLM call), to inject guidance the app pushed while the model was working. Drained via PendingMessageQueue::try_drain.
  • follow-up: fired when the loop would otherwise stop (no tool calls + no steering), to keep the conversation going with queued user messages.

Both reuse the same PendingMessageQueue type with a QueueMode controlling how many messages a single try_drain releases.

Structs§

PendingMessageQueue
A FIFO of AgentMessages waiting to be injected at a drain point. Mirrors TS PendingMessageQueue. Clone so Agent can keep a steering instance and a follow-up instance independently.