Skip to content

v0.15.0 — Per-Operation Enforcement in Watch Mode

Choose a tag to compare

@Siddhant-K-code Siddhant-K-code released this 11 Apr 17:36
· 132 commits to main since this release
3630a27

Per-Operation Enforcement in Watch Mode

Watch mode can now enforce rate limits per tool, not just per session. This is handy when you want to let an agent call read_file freely but cap how many times it can call bash or write_file in a single run.

from agent_trace.watch import WatcherConfig, OperationRule

config = WatcherConfig(
    max_tool_calls=100,
    operation_rules=[
        OperationRule(operation="bash", max_calls=10),
        OperationRule(operation="write_file", max_calls=5, window_seconds=60),
    ],
    max_context_pct=80.0,  # warn when context window is 80% full
)

You can also set a context window threshold from the CLI:

agent-trace watch --max-context-pct 80 SESSION_ID

When the threshold is crossed, watch mode fires a warning before the session hits the hard limit — giving you time to intervene or checkpoint.