Skip to main content

AgentSave โ€” Cut AI agent token costs. One line of code.

SDK Tests Playwright License: MIT Token reduction

The first AI agent efficiency platform. Drop-in Python supervisor + real-time cost dashboard + inference router. Targeting ~30% token reduction with no accuracy loss โ€” see BENCHMARKS.md.

AgentSave Dashboard Overview

flowchart LR
    SDK["๐Ÿ’ก pip install agentsave"]
    WRAP["supervise(agent)"]
    SUP["Supervisor\nContext Filter + Early Exit\n+ Budget Gate"]
    TEL["TelemetryClient\n(opt-in, zero PII)"]
    API["Dashboard Backend\nFastAPI + SQLite"]
    UI["agentsave-ui\nNext.js Dashboard"]
    IR["InferRoute\nDocker Sidecar"]
    VLLM["vLLM / SGLang\nCluster"]

    SDK --> WRAP
    WRAP --> SUP
    SUP -->|async fire-and-forget| TEL
    TEL --> API
    API --> UI
    SUP -->|"~30% token reduction"| WRAP
    IR -->|"~68% TTFT reduction"| VLLM
    API -.->|Enterprise tier| IR

๐Ÿ”ฅ The Problem

  • Every LLM agent wastes 30โ€“50% of tokens on irrelevant tool outputs โ€” inflating costs with no accuracy gain
  • Agents over-iterate past diminishing returns, burning tokens on iterations that add nothing
  • Developers have zero visibility into which agents, models, and frameworks are costing them the most

โšก The Solution

SDK Layer

pip install agentsave, then wrap any agent with supervise(agent). The supervisor filters irrelevant context, exits early on diminishing returns, and enforces a budget gate โ€” currently measuring ~23% token reduction on internal benchmarks, targeting ~30% on GAIA. See BENCHMARKS.md.

Dashboard Layer

Real-time cost tracking across every run, with a per-framework breakdown, an hourly activity heatmap, and an interactive cost projector to forecast monthly savings.

InferRoute Layer

PPD (append-prefill decode) routing for multi-turn agent workloads, delivering ~68% Turn 2+ TTFT reduction. Available on the Enterprise tier as a Docker sidecar in front of your vLLM / SGLang cluster.

๐ŸŽฌ In Action

  1. Overview dashboard โ€” real-time savings stats with animated counters Overview
  2. Analytics โ€” token reduction trend over time (area/line/bar toggle) Analytics
  3. Agent Runs โ€” full run history with framework badges and reduction % Runs
  4. Cost Projector โ€” interactive sliders to project monthly savings Cost Projector
  5. Live Activity Feed โ€” real-time agent run stream Activity Feed
  6. Hourly Heatmap โ€” GitHub-style activity grid Heatmap
  7. Command Palette โ€” instant navigation and actions (โŒ˜K) Command Palette
  8. Billing โ€” Free / Pro / Enterprise tiers Billing

๐Ÿš€ Quick Start

SDK only (no dashboard required):

pip install agentsave
from agentsave import supervise
agent = supervise(your_agent)   # wrap once โ€” savings happen automatically
result = agent.invoke({"input": "your task"})
print(agent.last_run_state.tokens_consumed)  # see what was used

Full stack (SDK + dashboard backend + UI):

# 1. Start the dashboard backend
pip install agentsave-dashboard
agentsave-dashboard serve     # prints an API key on first run โ€” copy it

# 2. Connect the SDK to your dashboard
cd your-project
agentsave login               # enter dashboard URL + API key when prompted
agentsave status              # confirm connection

# 3. Run your agents โ€” telemetry flows automatically

# 4. Open the UI (the dashboard backend itself takes no config env vars โ€”
#    these connect the separate Next.js UI to it, server-side and browser-side)
git clone https://github.com/aks-builds/agentsave-ui
cd agentsave-ui && npm install
# add AGENTSAVE_API_KEY=ask-xxx and NEXT_PUBLIC_AGENTSAVE_API_KEY=ask-xxx to .env.local
npm run dev                   # http://localhost:3000

InferRoute (Enterprise, requires a vLLM/sGLang cluster):

git clone https://github.com/aks-builds/agentsave-inferroute
cd agentsave-inferroute
docker build -t inferroute .
docker run -d -p 8080:8080 \
  -e BACKEND_URL=http://your-vllm:8000 \
  -e BACKEND_TYPE=vllm \
  -e AGENTSAVE_TOKEN=$ENTERPRISE_LICENSE_JWT \
  inferroute

InferRoute requires an Enterprise license key and a self-hosted vLLM or sGLang inference cluster.

๐Ÿ“ฆ Installation

SDK:

pip install agentsave

# Framework-specific extras:
pip install "agentsave[langchain]"     # LangChain + LangGraph
pip install "agentsave[autogen]"       # AutoGen (via ag2)
pip install "agentsave[crewai]"        # CrewAI
pip install "agentsave[smolagents]"    # Smolagents
pip install "agentsave[all]"           # All frameworks

Dashboard backend:

pip install agentsave-dashboard
agentsave-dashboard serve --host 127.0.0.1 --port 8000

Dashboard UI:

git clone https://github.com/aks-builds/agentsave-ui
cd agentsave-ui && npm install
npm run dev   # http://localhost:3000

InferRoute (Enterprise, requires vLLM/sGLang cluster):

pip install agentsave-inferroute   # Python library + inferroute CLI
# OR run as a Docker container:
git clone https://github.com/aks-builds/agentsave-inferroute
cd agentsave-inferroute
docker build -t agentsave-inferroute .
docker run -p 8080:8080 -e BACKEND_URL=http://vllm:8000 agentsave-inferroute

๐Ÿงช Verified Test Results

All numbers below come from actual runs โ€” no projections or targets stated as facts.

SDK โ€” pytest (CI-verified, Python 3.11/3.12/3.13):

88 passed, 3 skipped   (3 skipped = CrewAI import blocked by langchain 1.x on Python 3.14)
Ran in ~9s

Dashboard backend โ€” pytest (CI-verified, Python 3.11/3.12/3.13):

26 passed
Ran in ~1s

InferRoute โ€” pytest (CI-verified, Python 3.11/3.12/3.13):

59 passed, 1 warning
Ran in ~4s

UI โ€” Playwright (requires running backend, not in CI):

Layer 1 (API-only, no browser):  15 passed   โ† tests /api/* endpoints directly
Layer 2 (browser, structure):    33 passed   โ† tests page rendering, navigation
Layer 3 (SDKโ†’UI full-stack):      8 passed   โ† simulates SDK telemetry, verifies UI updates
Total:                            56 passed

Full-stack E2E with realistic data:

30 agent runs across 5 frameworks (LangChain, AutoGen, CrewAI, Smolagents, LangGraph), token counts 800โ€“4 000/run, measured with agentsave-dashboard receiving telemetry from the SDK:

Token reduction:   29.6%   (target: ~30%)
Success rate:      86.7%
Frameworks tested: 5 / 5
Accuracy loss:     0%       (verified on 20-task synthetic benchmark)

See BENCHMARKS.md for the per-task synthetic benchmark (23.2% on static tasks) and the realistic workload results side-by-side.

What is and is not tested end-to-end today:

Component Tested How
SDK adapters (LangChain, LangGraph, AutoGen, Smolagents) โœ… Integration tests with real framework objects
SDK โ†’ dashboard telemetry flow โœ… Full-stack E2E: SDK POSTs to dashboard, UI reflects data
Dashboard API endpoints โœ… 26 pytest + 15 Playwright API tests
Dashboard UI (browser) โœ… 33 Playwright browser tests
CrewAI adapter โœ… local, โš ๏ธ CI skipped Import fails on Python 3.14 (langchain 1.x compat)
InferRoute TTFT reduction โš ๏ธ projected ~68% is architectural projection; not yet measured on real cluster
pip install agentsave-dashboard โœ… On PyPI
pip install agentsave-inferroute โœ… On PyPI
Docker image (inferroute) โš ๏ธ build from source Not yet on Docker Hub โ€” docker build from repo

๐Ÿ— Architecture

  • Drop-in, zero-modification: supervise(agent) wraps any agent framework without touching internals
  • LLM-free context filter: TF-IDF cosine similarity โ€” no extra API calls, <1ms overhead per observation
  • Benchmark-backed: 23.2% on synthetic 20-task set, 29.6% measured on realistic multi-framework workloads, 0% accuracy loss โ€” see BENCHMARKS.md
  • Five framework adapters: LangChain, LangGraph, AutoGen, CrewAI, Smolagents โ€” all tested
  • InferRoute PPD routing: ~68% Turn 2+ TTFT reduction is an architectural projection; requires Enterprise license and a self-hosted vLLM/sGLang cluster
  • Opt-in telemetry: zero PII โ€” only run_id, framework, model, token counts, success flag
  • Self-hostable: SDK, dashboard backend, and UI are MIT-licensed and install from source; InferRoute requires a paid Enterprise license (RS256 JWT, verified offline, no cloud check) and is licensed separately โ€” see agentsave-inferroute

๐Ÿ—บ Roadmap

v0.2:

  • JavaScript/TypeScript SDK for Node.js agent frameworks
  • Real-time WebSocket events for the live feed
  • Team workspaces with RBAC

v0.3:

  • OpenAI Responses API adapter
  • Anthropic tool_use adapter
  • Cost anomaly alerts (email + webhook when a run exceeds threshold)

Tracked as GitHub Issues.

๐Ÿ“ Project Structure

agentsave/              โ† SDK (this repo)
โ”œโ”€โ”€ agentsave/          โ† Python package
โ”‚   โ”œโ”€โ”€ core/           โ† context filter, early exit, budget gate, supervisor
โ”‚   โ”œโ”€โ”€ adapters/       โ† LangChain, LangGraph, AutoGen, CrewAI, Smolagents
โ”‚   โ”œโ”€โ”€ telemetry/      โ† opt-in async telemetry client
โ”‚   โ””โ”€โ”€ cli/            โ† agentsave login/status/config
โ””โ”€โ”€ tests/              โ† 88 tests (unit + integration)

agentsave-dashboard/    โ† FastAPI + SQLite backend
โ”œโ”€โ”€ agentsave_dashboard/
โ”‚   โ”œโ”€โ”€ routers/        โ† /api/events, /api/runs, /api/metrics (also serves /api/tokens), /api/billing
โ”‚   โ”œโ”€โ”€ license.py      โ† RS256 JWT license validation, tier โ†’ feature flags
โ”‚   โ””โ”€โ”€ services/       โ† metrics aggregation, retention
โ””โ”€โ”€ tests/              โ† 26 tests

agentsave-ui/           โ† Next.js 16 dashboard
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ components/     โ† StatCard, charts, RunsTable, ActivityFeed, CommandPalette
โ”‚   โ””โ”€โ”€ (routes)/       โ† /, /analytics, /runs, /frameworks, /cost, /settings
โ””โ”€โ”€ tests/e2e/          โ† 56 Playwright tests (3 layers)

agentsave-inferroute/   โ† Enterprise inference router
โ”œโ”€โ”€ src/inferroute/
โ”‚   โ”œโ”€โ”€ classifier.py   โ† Turn 1 vs Turn 2+ detection
โ”‚   โ”œโ”€โ”€ scoring.py       โ† PPD scoring function
โ”‚   โ”œโ”€โ”€ dispatcher.py   โ† request dispatch + license gate
โ”‚   โ””โ”€โ”€ adapters/       โ† vLLM + SGLang
โ””โ”€โ”€ tests/              โ† 59 tests

๐Ÿค Contributing

See CONTRIBUTING.md for setup instructions, code style, and the PR checklist.

๐Ÿ“„ License

MIT ยฉ 2026 Aditya Kumar Singh

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentsave-0.1.1.tar.gz (959.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentsave-0.1.1-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file agentsave-0.1.1.tar.gz.

File metadata

  • Download URL: agentsave-0.1.1.tar.gz
  • Upload date:
  • Size: 959.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for agentsave-0.1.1.tar.gz
Algorithm Hash digest
SHA256 476f648869788d7359f75a9392a7f2fd3a5e17186bcdcdb4f48def8d52ceaacc
MD5 4964c470a3048e27fd4de6ea2f76deb3
BLAKE2b-256 779e1ad7ee0d5e8f950b2a461f297d9ea69aa718b1462316a38a505ea5f0517e

See more details on using hashes here.

File details

Details for the file agentsave-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: agentsave-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for agentsave-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7a7995f6eeee6b0b2374c3c713c1f9f8c72ecd917f595ecf28a9386cc087a36b
MD5 6eebd6c1f625b3a021dd981d2d064688
BLAKE2b-256 baf1eb75f88482592a0e81a1f46e8d3e41c4ba9a7e38c92f57178186af6f6242

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page