Skip to content

Commit cb3fe47

Browse files
Include usage in content_block:end events
Orchestrator includes response usage in content_block:end event data, enabling rendering layer to display tokens as part of rendering the response content. This follows kernel philosophy: usage is response data, so it flows with content events rather than requiring separate event correlation. 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
1 parent 8c56f0f commit cb3fe47

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

amplifier_module_loop_basic/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,11 @@ async def execute(
186186
},
187187
)
188188

189-
# Emit block end with complete block
190-
await hooks.emit(CONTENT_BLOCK_END, {"block_index": idx, "block": block.to_dict()})
189+
# Emit block end with complete block and usage
190+
event_data = {"block_index": idx, "block": block.to_dict()}
191+
if usage:
192+
event_data["usage"] = usage.model_dump() if hasattr(usage, "model_dump") else usage
193+
await hooks.emit(CONTENT_BLOCK_END, event_data)
191194

192195
# Handle tool calls (parallel execution)
193196
if tool_calls:

0 commit comments

Comments
 (0)