?

Overview

Rousseau's cost knobs sit at three levels: what the model spends per turn, how many turns happen per session, and how often a daemon fires. Setting all three lets you catch a runaway prompt loop before it becomes an invoice.

The four levers

agent.max_iterations caps the tool-use loop. Default 32.

agent:
  max_iterations: 24

Set lower for narrow-purpose bots (community FAQ), higher for pair programming. Runaway loops (model calls the same tool 60 times) are always a bug or a prompt issue — the cap ensures they never burn through your budget.

Monitoring

Rousseau logs one agent.turn.finished event per turn with token usage (when the provider exposes it). Aggregate with the log platform of your choice.

Loki query:

sum by (project) (
  rate({service="rousseau"} |= "agent.turn.finished" | json | unwrap output_tokens [1h])
)

Graph per project, alert on >2× the moving average.

Anti-patterns

  • Unbounded max_iterations — a stuck agent can call read on a 500MB file 30 times. Cap it.
  • Long system prompts without cache markers — you pay full price for the same tokens every turn if the provider is not Anthropic. Consider moving big context into agent.skills_dir instead.
  • No allowlist on public transports — every message from a stranger costs LLM tokens. Always allowlist.

Related pages

Type to search 150+ pages. Ranking: BM25 with title/description boost.