CubeLoop — a Pythonic, async-native agent harness core designed for high performance, readability, and production-grade persistence.
Python agent-frameworkagent-harnessagent-runtimeagentic-aiai-agentsai-frameworkanthropicharnessharness-engineeringharness-frameworklanggraphlanggraph-alternativellmmcpopenaipi-agentpi-agent-corepythonpython-agent
docs: document on_run_end hook in README and CHANGELOG
xf gongc0dd77ca9091
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex bc6f17a..ab22fce 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## [Unreleased]+### Added++- **`on_run_end` middleware hook** — fires exactly once after all turns and tool+ calls complete, before `AgentEndEvent`. Return a `list[Message]` to inject+ additional messages and run one extra model turn (e.g. a memory-reflection+ pass); return `None` to do nothing.+ - `_reflection_fired` guard in the loop prevents the injected turn from+ re-triggering `on_run_end`.+ - `should_stop_after_turn` and `turn_action.decision == "stop"` paths now+ route through `on_run_end` before emitting `AgentEndEvent`. Error/aborted+ runs (`stop_reason in ("error", "aborted")`) skip the hook.+ - HITL-interrupted runs (HitlDetached / HitlAborted) also skip the hook —+ the conversation is paused, not finished.+## [0.6.0] - 2026-05-31### Addeddiff --git a/README.md b/README.mdindex 5294473..d9b13f9 100644--- a/README.md+++ b/README.md@@ -168,7 +168,10 @@ hooks = compose_middleware([LoggingMiddleware(), SafetyMiddleware()])| `convert_to_llm` | Last implementation wins || `before_tool_call` | Any block stops execution || `after_tool_call` | Later overrides earlier |+| `transform_system_prompt` | Chained — each receives previous result |+| `after_model_response` | Returns `TurnAction`; last decision wins, messages concatenate || `should_stop_after_turn` | Any true stops |+| `on_run_end` | Messages concatenate; non-empty result triggers one extra model turn |### Checkpointer