1 Commits

Author SHA1 Message Date
Ethan
fd04ad353d Add Anthropic prompt caching to the agent loop (#812)
Send `system` as a structured text block with an ephemeral cache_control
breakpoint and cache the last tool schema, so multi-round agent runs read
the stable system+tools prefix from cache instead of re-billing it. Gate
the system breakpoint so tiny tool-less prompts skip the cache-write
premium. Log cache_read/creation tokens at message_start.

Fixes #791

Co-authored-by: Ethan <23321960+0xLeathery@users.noreply.github.com>
2026-06-02 11:14:31 +09:00