Agent Lens
Track AI agent API calls, analyze token usage, and optimize costs. Use when user wants to monitor LLM spending, debug API calls, track token consumption, or... Skill: Agent Lens Owner: lrg913427-dot Summary: Track AI agent API calls, analyze token usage, and optimize costs. Use when user wants to monitor LLM spending, debug API calls, track token consumption, or... Tags: latest:3.0.0 Version history: v2.17.3 | 2026-06-13T10:01:59.198Z | auto - Version bumped from 2.17.0 to 2.17.2 in SKILL.md. - Internal documentation updated; no functional or interface changes to features o
Rank
62
Safety
84
Downloads
2.7k
Updated
Oct 9, 2026
Version
2.17.3
Source
CLAWHUB
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 2.7K downloads reported by the source. Last updated 10/9/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · observed Oct 9, 2026
- Protocol compatibility
- OpenClawcompatibility · observed Oct 9, 2026
- Adoption signal
- 2.7K downloadsadoption · observed Oct 9, 2026
- Latest release
- 2.17.3release · observed Jun 13, 2026
- Handshake status
- UNKNOWNsecurity
Install and run
Setup complexity: low.
clawhub skill install s175nn6ap9fe4ne23bws9svzm185ywrq:agent-lens- Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
- Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-lrg913427-dot-agent-lens/snapshot"
Documentation
CLAWHUB
80,420 characters of source documentation, loaded on request.
Extracted files
3 files captured from the source.
SKILL.md
---
name: agent-lens
description: "Track AI agent API calls, analyze token usage, and optimize costs. Use when user wants to monitor LLM spending, debug API calls, track token consumption, or generate cost reports for OpenAI/Anthropic/Google/DeepSeek APIs."
version: 2.17.2
author: lrg913427-dot
license: MIT
metadata:
hermes:
tags: [llm, cost, tracking, observability, tokens, api, monitoring, agent]
related_skills: [db-explorer]
---
# Agent Lens
Track every AI API call, analyze token usage, and optimize costs.
## When to Use
Activate this skill when the user:
- Says "how much am I spending", "token usage", "API costs"
- Wants to know which model is most expensive
- Needs to optimize prompt costs
- Wants to track API call latency or error rates
- Mentions "budget", "cost optimization", or "token counting"
- Asks "why is my API bill so high"
## Quick Start
```bash
# Install
pip install git+https://github.com/lrg913427-dot/agent-lens.git
# Generate demo data and see it in action
agent-lens demo
# View stats
agent-lens stats
agent-lens cost
agent-lens recent
```
## Three Ways to Track
### 1. Decorator (easiest)
```python
from agent_lens import AgentLens
lens = AgentLens(agent_name="my-agent")
@lens.track(model="gpt-4o")
def call_api(prompt):
return client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": prompt}],
)
# Token usage is auto-extracted from OpenAI-style responses
result = call_api("Hello")
```
### 2. Context Manager (flexible)
```python
from agent_lens import AgentLens
lens = AgentLens(agent_name="my-agent")
with lens.trace(model="claude-3.5-sonnet") as t:
result = client.chat.completions.create(...)
t.input_tokens = result.usage.prompt_tokens
t.output_tokens = result.usage.completion_tokens
```
### 3. Direct Record (manual)
```python
from agent_lens import AgentLens
lens = AgentLens(agent_name="my-agent")
lens.record(
model="gpt-4o",
input_tokens=1500,
output_tokens=800,
latency_ms=2300,
)
```
### Global Shortcuts
```python
from agent_lens import record, trace, track
record(model="gpt-4o", input_tokens=100, output_tokens=50)
with trace(model="gpt-4o") as t:
...
@track(model="gpt-4o")
def my_func():
...
```
## CLI Commands
| Command | Description |
|---------|-------------|
| `agent-lens stats` | Overview: total calls, tokens, cost |
| `agent-lens report --by model` | Breakdown by model/provider/agent |
| `agent-lens cost` | Cost ranking with percentage bars |
| `agent-lens recent -n 10` | Latest API calls |
| `agent-lens top` | Most expensive calls |
| `agent-lens export --json` | Export to JSON |
| `agent-lens export -o data.csv` | Export to CSV |
| `agent-lens clean --before <ts>` | Clean old data |
| `agent-lens demo` | Generate sample data |
## Cost Optimization Workflow
When user asks "how can I save money":
1. **Run cost report**: `agent-lens cost`
2. **Identify expensive models**: Which models cost the m_meta.json
{
"ownerId": "kn78qy8qw1m82vx09qkaawp9c985z0mn",
"slug": "agent-lens",
"version": "2.17.3",
"publishedAt": 1781344919198
}skill-card.md
## Description: <br> Track AI agent API calls, analyze token usage, and optimize costs for OpenAI, Anthropic, Google, DeepSeek, and other LLM APIs. <br> This skill is ready for commercial/non-commercial use. <br> ## Publisher: <br> [lrg913427-dot](https://clawhub.ai/user/lrg913427-dot) <br> ### License/Terms of Use: <br> MIT-0 <br> ## Use Case: <br> Developers and agent operators use this skill to instrument local LLM API calls, inspect token consumption, report costs, and identify expensive models, long prompts, repeated calls, latency issues, or error patterns. <br> ### Deployment Geography for Use: <br> Global <br> ## Known Risks and Mitigations: <br> Risk: API telemetry may reveal model choices, usage patterns, costs, and call metadata when used on sensitive workloads. <br> Mitigation: Review what the referenced Python package records before connecting sensitive workloads, and protect or periodically clean its local SQLite database according to retention needs. <br> ## Reference(s): <br> - [Agent Lens on ClawHub](https://clawhub.ai/lrg913427-dot/agent-lens) <br> - [lrg913427-dot publisher profile](https://clawhub.ai/user/lrg913427-dot) <br> ## Skill Output: <br> **Output Type(s):** [Text, Markdown, Code, Shell commands, Guidance] <br> **Output Format:** [Markdown with inline shell commands, Python snippets, and operational guidance] <br> **Output Parameters:** [1D] <br> **Other Properties Related to Output:** [May include cost-analysis steps, CLI command suggestions, token-counting snippets, and local SQLite data-handling guidance.] <br> ## Skill Version(s): <br> 2.17.3 (source: server release metadata) <br> ## Ethical Considerations: <br> Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>
AionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/lrg913427-dot/skills/agent-lens",
"sourceUrl": "https://clawhub.ai/lrg913427-dot/skills/agent-lens",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-09T12:11:21.503Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-lrg913427-dot-agent-lens/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-lrg913427-dot-agent-lens/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-09T12:11:21.503Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "2.7K downloads",
"href": "https://clawhub.ai/lrg913427-dot/agent-lens",
"sourceUrl": "https://clawhub.ai/lrg913427-dot/agent-lens",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-09T12:11:21.503Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "2.17.3",
"href": "https://clawhub.ai/lrg913427-dot/agent-lens",
"sourceUrl": "https://clawhub.ai/lrg913427-dot/agent-lens",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-06-13T10:01:59.198Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-lrg913427-dot-agent-lens/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-lrg913427-dot-agent-lens/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 2.17.3",
"description": "- Version bumped from 2.17.0 to 2.17.2 in SKILL.md. - Internal documentation updated; no functional or interface changes to features or commands. - Removed skill-card.md file.",
"href": "https://clawhub.ai/lrg913427-dot/agent-lens",
"sourceUrl": "https://clawhub.ai/lrg913427-dot/agent-lens",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-06-13T10:01:59.198Z",
"isPublic": true
}
]
}Record generated Oct 9, 2026.
