Repository navigation
v1.38.0
Highlights
A PreIteration hook can now end a turn on purpose. Before, a long tool loop
stopped only at the tool iteration limit, and a hook could only abort it with
an error. Now a hook can see that the next call would cross a context or
pricing ceiling, set FinalCall, and let the model write a closing answer
without tools. The application can then compact the session and continue in a
new turn.
Tell the model why the turn is ending with a Recorded reminder appended in the
same hook. The reminder is stored in the turn's output, so a replay sends the
same bytes as the live call and the prompt cache still hits. Nothing changes
for agents whose hooks don't set the flag.
Pull requests
- feat(agent): let a PreIteration hook make the next call final (#338)
Changelog
Added
HookContext.FinalCall. A PreIteration hook can make the next model call
the turn's last, with tools disabled, to wrap up before a context or price
ceiling. Pair it with a Recorded reminder to tell the model why.