ExAgent.Compaction.Capability (ExAgent v0.3.0)

Copy Markdown View Source

A capability that runs a compactor on before_model_request, shrinking the canonical history (and the request about to be sent) when it grows too large.

Add it to an agent's :capabilities:

%ExAgent.Compaction.Capability{
  compactor: ExAgent.Compaction.Summary,
  opts: [threshold_tokens: 6000, keep_recent: 8, summarize: &my_summarize/1]
}

Summary

Functions

after_model_request(cap, state)

Callback implementation for ExAgent.Capability.after_model_request/2.

after_tool_execute(cap, ctx, tool_call, result)

Callback implementation for ExAgent.Capability.after_tool_execute/4.

before_tool_execute(cap, ctx, tool_call)

Callback implementation for ExAgent.Capability.before_tool_execute/3.