We used OpenLIT to make an AI agent cheaper and safer, then shipped the walkthrough
Description and use
Reducing AI agent cost with OpenLIT: from $0.0052 to $0.0002 per run, a 26× savings by eliminating redundant tool calls and switching to a cheaper model.
Problem
High-cost, redundant tool calls in an AI support-desk agent leading to inefficiency and safety concerns.
Outcome
Reduced per-run cost from $0.0052 to $0.0002 (26× cheaper) by eliminating redundant tool calls and switching to a cheaper model, while improving safety through better loop logic.
Workflow
- Scan the repo for issues
- Fix high-severity problems (missing docstrings, insecure paths)
- Run the agent and capture the trace with OpenLIT
- Analyze the trace to identify redundant tool calls
- Tighten the loop logic
- Switch to a cheaper model (gpt-4o-mini)
- Re-run and verify cost reduction
- Ship the improved agent
Evidence
First run: repeat lookup_ticket / create_ticket calls, spend $0.0052.
Second run, after tightening the loop and switching to gpt-4o-mini: $0.0002, one lookup, one create.
- Record date: 2026-09-22T00:30:42.078Z