Observed since 20 Oct, 23:28 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
AgentSpend — runtime cost optimizer for AI agents. Route LLM calls to the cheapest capable model with fallbacks, loop guards, and telemetry.
AI cost optimization toolkit for LLM workloads.
token-aud now includes two complementary workflows:
plan, reason, tool, verify, draft, summarize) to cost/quality-appropriate models with fallbacks, loop guards, and telemetry.uv sync --no-editable
For local development tooling (tests):
uv sync --no-editable --extra dev
Run these three commands from repo root:
uv sync --no-editable --extra dev
uv run --no-sync python -m pytest tests/agent -q
uv run --no-sync python examples/agent_routing_demo.py
Expected results:
agent_telemetry.jsonl is generated locally.from token_aud.agent import AgentSpend
agent = AgentSpend.default()
result = agent.route_call(
step="plan",
messages=[{"role": "user", "content": "Break this task into a plan"}],
)
print(result.model_used, result.cost_usd, result.content)
from token_aud.agent import AgentSpend
agent = AgentSpend.from_yaml("routing_policy.yaml")
result = agent.route_call(
step="reason",
messages=[{"role": "user", "content": "Compare two architectures"}],
)
print(result.model_used, result.fallbacks_tried)
Built-in default policy path:
src/token_aud/data/default_routing_policy.yamlsrc/token_aud/agent/policy.py: Pydantic policy schema + YAML loadingsrc/token_aud/agent/router.py: deterministic model selectionsrc/token_aud/agent/runtime.py: route_call() execution + fallbackssrc/token_aud/agent/loop_guard.py: repeated-turn loop detectionsrc/token_aud/agent/telemetry.py: JSONL/HTTP telemetry sinkssrc/token_aud/agent/adaptive.py: optional adaptive routing layerexamples/agent_routing_demo.py: end-to-end routed run with telemetryexamples/custom_policy_demo.py: loop escalation and hard-stop behaviorexamples/framework_agnostic_integration.py: generic agent-loop integration with explicit success feedbackscripts/summarize_telemetry.py: convert agent_telemetry.jsonl into cost/fallback/latency summaryuv run --no-sync python scripts/summarize_telemetry.py agent_telemetry.jsonl
uv run --no-sync token-aud --help
uv run --no-sync token-aud analyze sample_data.csv --dry-run
Common provider credentials:
OPENAI_API_KEYANTHROPIC_API_KEYGEMINI_API_KEY or GOOGLE_API_KEY (depending on provider path)For Google Vertex flows, ensure ADC is configured (gcloud auth application-default login).
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.0 | 28 Feb 2026 | 16 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 23:28 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:b87a27e54998b5ff3b93fb4135bee5dd3b70b8a6bc813bd75f6d88e90ef7dbcf