trading_agent.runtime.steering_inbox
¶
Messages from the user that arrive while a desk is in the middle of a model turn.
Without steering, a message sent while the desk is busy waits until the turn ends, which can be minutes. With it, the message goes into this inbox instead, and the running turn picks it up at its next tool round: the agent loop adds it to the conversation before the next model call, and the Claude runner hands it over in a PostToolUse hook. A message the turn never picks up, because the turn ended without another tool round, is queued as its own turn afterwards, so nothing is lost.
Typical usage example:
inbox = SteeringInbox(event_bus, 'main') inbox.add(trigger, running_trigger_id) text = inbox.take_text()
SteeringInbox
¶
One desk's messages waiting to be handed to the running turn.
Creates an empty inbox.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_bus
|
EventBus
|
Where deliveries are announced. |
required |
desk_name
|
str
|
The desk. |
required |
Source code in src/trading_agent/runtime/steering_inbox.py
add
¶
Keeps a message for the running turn.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trigger
|
Trigger
|
The user's message. |
required |
running_trigger_id
|
str
|
The trigger of the turn that is running. |
required |
Source code in src/trading_agent/runtime/steering_inbox.py
take_text
¶
Hands every waiting message to the running turn, as one block of text.
Returns:
| Type | Description |
|---|---|
str | None
|
The messages, each with its time, or None when none is waiting. |
Source code in src/trading_agent/runtime/steering_inbox.py
take_undelivered
¶
Removes the messages the turn never picked up, so they can be queued as their own turns.
Returns:
| Type | Description |
|---|---|
list[Trigger]
|
The messages, oldest first. |