[Feature] Add a turn_final indicator to response policy context for end of agent chat
Problem or use case
Summary
The response policy is currently defined as being fired after the LLM's final assistant message. However, while testing this I noticed that this seems to be based on whenever the message itself gets flushed here in orchestration.py, which seems to also do a flush after a text response but before a tool is called (if one is being called). Certain policies may only want to run after the final response of the agent, not between these intermediary responses, so we may want a flag to indicate those terminal responses.
Proposed solution
I would like to propose a feature, or really just a flag, that specifies the final turn (before the LLM agent returns the conversation to you) in the context for the response PolicyEvent
- it could be defined as a parameter in
EventContextas well as a parameter inEvaluationContext. orchestration.pyhas two locations for flushing relay text. The first is for intermediate segments, but the second is for terminal segments. We can add a parameter to_flush_relay_textthat indicates whether or not this is the final turn that would then be passed through to_evaluate_output_policywhere the policies eventually get run, populating that flag in the context so that it would be visible within policies.
Alternatives considered
No response
Harness
No response
Platform or device
No response
Harness mode
No response
Expected reach
None
Authentication type
No response
Source: omnigent-ai/omnigent