2.7 KiB
01.4 — Tool output budgets, summarizer, artifacts
Finish moving tool-result post-processing to after_tool middleware and
delete the legacy hooks.
Steps
Current status: OpenHuman's local ToolOutputMiddleware now runs on the
TinyAgents harness as after_tool for payload summarization, TokenJuice
compact_output_with_policy, per-tool policy-derived output caps, generic byte
budgets, and action-workspace artifact spill for oversized session tool
results. The SDK's closest built-in cap is ToolPolicyMiddleware result-byte
enforcement, which remains disabled here because OpenHuman still owns the
legacy marker/artifact behavior. Payload summarization and TokenJuice shrinks
now emit TinyAgents AgentEvent::Compressed, and persisted action-workspace
artifacts are indexed in RunContext.stores under
openhuman_tool_result_artifacts while the existing .txt file and file_read
envelope remain the source of truth. The live TinyAgents middleware already
calls the parent-context-aware PayloadSummarizer::maybe_summarize_in_parent,
and that implementation dispatches the summarizer through
SubAgent::invoke_in_parent so child lineage/events inherit the parent
TinyAgents context. The older direct-executor payload-summarizer hook is
removed, the old session/agent_tool_exec.rs test-only parity shim is deleted,
and the stale default-Full tokenjuice::compact_tool_output wrapper is removed.
payload_summarizer.rs(live insrc/openhuman/tinyagents/; oversized-result compression via asummarizersub-agent + circuit breaker):ToolOutputMiddlewarenow calls the parent-context-aware summarizer seam, and that live path usesSubAgent::invoke_in_parentfor child depth/event lineage. Remaining work: emit any additionalSummaryRecord-style provenance needed beyondAgentEvent::Compressed.tokenjuice::compact_tool_output: deleted after confirmingcompact_output_with_policycovers the live TinyAgents middleware and legacy direct executor paths; decision recorded insrc/openhuman/tokenjuice/README.md.harness/tool_result_artifacts/mod.rs(588 lines, artifact spill): keep spill policy and action-workspace.txtwrites in OpenHuman, but keep the run'sStoreRegistry(RunContext.stores) populated with structured artifact metadata so replay can find the model-facing preview's full body.- Done:
session/agent_tool_exec.rswas deleted after the live turn path moved to TinyAgents middleware.
Deletions
- Deleted:
session/agent_tool_exec.rslegacy direct-executor shim. tokenjuice::compact_tool_output.
Acceptance
- Oversized tool result → compressed with provenance event; parity fixture vs old summarizer output shape.
- No tool-result post-processing outside middleware.