Built locally. Your API key stays with your agent.

AgentWarden reduces your agent tokens drastically.

A local Python package with two simple steps to use, track, and reduce your OpenAI token usage.

Two stepsPython 3.11+

01$ pip install agentwarden-ai

02$ agentwarden dashboard

In your existing OpenAI client

base_url = "http://127.0.0.1:8080/v1"

Same SDK. Same API key. Local proof for every session.

Measured savings

A receipt, not a promise.

A real local lead-agent run reduced context after warm-up while preserving the completed workflow. The request-level receipt shows exactly what changed.

Same tool sequence Local SQLite receipt Per-request evidence
AgentWarden before and after context receipt showing 13.8 percent reduction
Controlled lead-enrichment workflow. Savings depend on repeated agent context.

Turn them on

Four conservative passes. Opt in explicitly.

Every optimizer starts off. Open the dashboard settings button, enable the passes you want, then apply them to the running local proxy. The settings reset when the proxy stops, so use environment variables when you want durable defaults.

Longer agent loops create more opportunity. Tool Prune learns from the session after three unchanged warm-up requests. In tool-heavy workflows, 10-15+ requests can reduce input cost by roughly 16-50%, depending on repeated tools and history.

AgentWarden dashboard optimizer settings with four toggles
Open settings in the local dashboard, enable the toggles, then apply them.
Opt-in pass

Tool Prune

After three warm-up requests, removes unused tool schemas while retaining tools already called or named in the current request.

Opt-in pass

History Trim

Keeps recent turns intact and clips older tool-result messages that no longer need full detail.

Opt-in pass

Context Dedup

Replaces repeated history blocks with a deterministic reference to the original content.

Opt-in pass

Cache Order

Stabilizes the system-and-tools prefix so provider prompt caching has a better chance to apply.

The 16-50% range is a workload-dependent potential, not a guarantee. Your local receipt shows the actual result for each session.

AgentWarden token anatomy showing system, tools, history, and current context

Know the waste

See where every input token went.

AgentWarden separates system instructions, tool schemas, conversation history, and the current turn. You can see whether tools or history are creating the cost before enabling an optimizer.

System promptTool schemasConversation historyCurrent turn

Local dashboard

Inspect every agent run
without shipping its data elsewhere.

Start one local command, select a session, then inspect cost, tokens avoided, tools offered, latency, and the exact optimization passes used.

AgentWarden local dashboard showing token savings and request trace evidence

How it works

One URL change.
A guarded path to OpenAI.

AgentWarden runs between your existing agent and the OpenAI Chat Completions API. Streaming stays intact, and your authorization header passes through from your own process.

1Your agent

Same SDK and tools.

2AgentWarden

Measures, trims, and relays locally.

3OpenAI

Receives the compatible request.

What ships today

A practical optimization layer for tool-using agents.

Segmented tracing

See system, tools, history, and current-turn tokens separately.

Conservative tool pruning

After warm-up, remove unused schemas while retaining explicitly needed tools.

Deterministic cleanup

Trim older tool outputs, deduplicate old history, and stabilize cacheable prefixes.

Budget and replay proof

Warn on projected session spend and validate important workflows.

Independent and open source

Created by Jahan Shah.

Built during OpenAI Build Week with Codex and GPT-5.6, for developers who want their agents to stay capable while becoming meaningfully easier to understand and afford.

View the project