Currently when a task is cancelled (Ctrl+C), we record the cancellation but cannot save the partial messages and token usage accumulated up to that point.
The agent's run() method uses a simple iteration pattern that doesn't expose intermediate state:
async for state in self.iter(...):
result_state = state
return result_state.run_ctx
To capture partial state, we would need to either:
- Store the last yielded state in an instance variable accessible on cancellation
- Implement streaming with real-time state callbacks
This would be useful for debugging cancelled runs and understanding how far execution progressed before interruption.