Message Steering Protocol • AI Agent SDK
MessageSteeringProtocol: Protocol for message steering during agent execution.
MessageSteeringProtocol
Defined in the protocols module.
AI Agent
Protocol for message steering during agent execution.
This protocol enables real-time communication with agents during long-running operations, allowing users to provide mid-execution guidance, feedback, and course corrections.
Methods
queue_message()
Queue a steering message for the agent.
get_pending_messages()Get all pending steering messages.
process_steering()Process any pending steering messages and update execution context.
clear_messages()Clear all pending messages.
has_pending_messages()Check if there are pending steering messages.
enabled()Whether message steering is enabled.
Usage
class BasicMessageSteering:
def queue_message(self, message: str, priority: int = 5) -> str:
# Add to internal queue
return "msg_001"
def get_pending_messages(self) -> List[SteeringMessage]:
# Return queued messages
return []
def process_steering(self, context: dict) -> bool:
# Check for messages and update context
return False
agent = Agent(name="assistant", message_steering=BasicMessageSteering())Source
View on GitHubpraisonaiagents/agent/protocols.py at line 454