Inspiration
AI agents are becoming part of everyday work, from personal automation to large company workflows. But multi-step agents can become expensive because they repeatedly resend tool definitions and growing conversation history to the model. I built Agentwarden to make that waste visible and reduce it locally, without requiring developers to rebuild their agents.
What it does
AgentWarden is a local Python package for OpenAI agents. Install it with pip install agentwarden-ai , run agentwarden dashboard , enable the optimizers you want, and change your agent’s base_url to the local proxy.
It traces where tokens are spent across system instructions, tools, history, and the current turn. Its opt-in optimizers prune unused tools, trim stale tool output, remove repeated context, and stabilize static prefixes for prompt caching. The dashboard provides a local before/after receipt for each agent session. In one real tool-using workflow, AgentWarden reduced input context by 13.8% while preserving the same tool sequence. Longer, tool-heavy workflows have more opportunity for savings.
How we built it
We built AgentWarden as a local Python package that sits between an existing agent and the OpenAI Chat Completions API. The core is a FastAPI proxy that preserves normal and streaming requests, forwards the developer’s own API key, and records token usage by system prompt, tools, history, and current turn in local SQLite. On top of that, we added opt-in deterministic passes for pruning unused tools, trimming stale tool output, removing duplicate context, and stabilizing cacheable prefixes, plus a dashboard that turns every run into a before/after receipt. We used Codex with GPT-5.6 throughout the build to implement and iterate on the proxy, tests, optimizer pipeline, dashboard, packaging, and documentation, while validating the product against real multi-step agents.
Challenges we ran into
The hardest part was reducing context without changing the agent’s behavior. We made every optimizer opt-in, kept the first Tool Prune requests unchanged for warm-up, and built tracing and replay checks to compare optimized runs against baseline behavior. Codex and GPT-5.6 ( and coffee ) helped me iterate quickly, but I still had to test the actual agent behavior and make conservative product decisions.
Accomplishments that we're proud of
I’m proud that AgentWarden became a real, installable developer tool rather than only a prototype. It is published on PyPI, open source on GitHub, has a local dashboard, and has already been tested with real multi-step agents. I’m also proud that adoption is simple: run two commands, change one base URL, and get a clear receipt for every session.
What we learned
We learned that agent cost often comes less from a single model response and more from repeatedly resending tool schemas and growing history on every step. We also learned that savings claims need evidence: local traces, before/after receipts, and behavior checks make optimization trustworthy rather than just impressive-looking
What's next for AgentWarden
Next, we want to support the OpenAI Responses API and additional agent frameworks while keeping the same drop-in integration. We will improve replay verification, add more real-world benchmarks, and help developers identify savings opportunities across longer production agent workflows.
Built With
- chatgpt5.6
- codex
- fastapi
- nextjs
- openai
- python
- python-package-index
Log in or sign up for Devpost to join the conversation.