Hi Graham sir! I studied this problem in depth and found that neither callbacks nor hooks will be usable for the above use-case. This is because both the user defined callbacks and hooks are executed before the
default callback (which adds the event to the conversation.state.events list). So there is no way to add a Message Event after the ObservationEvent from the (N-1)th step to remind the agent to stop. In my case, I want this reminder to be added exactly before sampling the last action from the agent.
The solution is to simply run the agent in 2 phases -- first run it for a maximum of N-1 steps and if it did not complete the task/call finish tool, call conversation.send_message("reminder_message") and then call conversation.run() again.