Question
I would like to know if there is a recommended way to:
- Inject Agent Responses: Send a message that is visually and functionally treated as an "Assistant/Agent" output (including markdown/syntax highlighting).
- Message Interception: A hook or middleware to intercept a message generated by the agent before it reaches the UI, allowing for real-time transformation.
Context
I am developing a plugin where I need to either intercept agent messages for transformation or send messages on behalf of the agent.
Current Behavior
Currently, using client.session.prompt with the noReply: true option allows sending a message to the session, but it has two main limitations for this use case:
- User Role: The message is sent as the user, not the agent.
- Formatting & Costs: These messages appear to consume input tokens and lack the syntax highlighting typically applied to agent outputs.
Question
I would like to know if there is a recommended way to:
Context
I am developing a plugin where I need to either intercept agent messages for transformation or send messages on behalf of the agent.
Current Behavior
Currently, using
client.session.promptwith thenoReply: trueoption allows sending a message to the session, but it has two main limitations for this use case: