
Agent Observability
io.github.KryptosAI由 GitHub 账号 KryptosAI 发布v1.0.7更新于 Oct 24, 2026
Trace AI agent execution: every tool call, every error, every dollar. Open source, local-first.
概览
一个本地优先的 MCP 服务器,把 AI 代理会话中的工具调用、token 用量、决策与评级记录到本地 SQLite 数据库,并提供仪表盘。
- 可以做什么
- 记录工具调用,包括名称、所属服务器、耗时、状态、输入与输出,并记录每个会话的 token 用量与估算费用,记录决策点(上下文、选项、所选方案与理由),给出 A–F 会话评级及理由,再读取完整会话报告或列出历史会话及其评级、token 总量与费用。配套的本地仪表盘与 REST 接口提供会话、工具调用、token、决策、搜索、统计与 JSON 导出。
- 适用场景
- 当你希望为 Claude Code、Cursor 或 opencode 的会话留下“飞行记录仪”时使用:查看执行了哪些工具、失败原因、花费多少,并保留读取或修改文件的审计轨迹。适合调优提示词和估算开销。
- 运行要求
- 通过 npx(包名 agent-obs)作为本地 Node.js 进程运行;未声明认证、环境变量或请求头。安装会为检测到的代理写入 MCP 配置,数据保存在用户主目录下的本地 SQLite 数据库。仪表盘监听本地端口 9400。
安装
在 SourceWeft 中
- 打开 控制台中的 Agent Observability,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
agent-observability
Open source agent observability — see what your agents did, why they failed, and what it cost. Runs locally. No cloud required.
Quick Start
One command. No manual config. No copy-paste.
This auto-detects your AI agent (opencode, Claude Code, Cursor) and configures everything:
- Adds agent-obs to your MCP config
- Adds the self-reporting instruction
- Tells you what to do next
Then restart your agent. Every action will now self-report.
What you'll see
After running a task in your agent, the dashboard shows:
- Every tool call with duration and status
- A-F session grade (how efficient was your agent?)
- Cost per session in tokens and dollars
- Full audit trail of what was read, edited, and executed
Manual setup (if setup can't detect your agent)
opencode: Add to opencode.json:
Claude Code: Create .mcp.json:
Cursor: Add to Cursor Settings > MCP:
See Agent-Specific Setup below for detailed per-platform instructions including self-reporting directives.
Note: All data is written to a local SQLite database in
~/.agent-observability/. No data leaves your machine.
Proxy mode (fallback)
For agents that can't self-report, wrap any MCP server and every tool invocation gets traced automatically:
Proxy mode captures only MCP tool calls (~30% of typical agent actions). Prefer the setup / MCP server approach above.
Agent-Specific Setup
Claude Code
- MCP Config — Create
.mcp.jsonin your project root:
- Self-reporting instruction — Create
.claude/instructions.md(or reference the existing SKILL.md under.claude/skills/agent-obs/SKILL.md):
- Verify — Run
agent-obs dashboard, open http://localhost:9400, and look for your session after the agent completes a task.
Cursor
- MCP Config — Add to Cursor's MCP settings (
~/.cursor/mcp.json, or Settings → MCP → Add new global MCP server):
- Self-reporting instruction — Create
.cursorrules(or.cursor/rules/agent-obs.md):
- Verify — Run
agent-obs dashboard, open http://localhost:9400, and look for your session after the agent completes a task.
Architecture
API Reference
REST Endpoints (Dashboard)
MCP Tools (Server Mode)
What Gets Tracked
Every tool call
- Tool name — e.g.
read_file,execute_command,search_code - Server — which MCP server handled it
- Duration — wall-clock milliseconds
- Status —
successorerror - Input — full arguments passed to the tool
- Output — full result returned (truncated at 64KB for storage)
Token consumption
- Input tokens — prompt and context
- Output tokens — generated response
- Total tokens — sum per session
- Per-call breakdown — token delta for each LLM round-trip
Cost estimation
Costs are estimated based on published API pricing:
Costs are tracked per session and displayed in the dashboard. You can add custom model pricing via ~/.agent-observability/models.json.
Session grades
Every session receives a letter grade based on efficiency and correctness:
Decision points
When the agent has multiple possible actions, it can record why it chose one over another. Example:
Decision points create an audit trail of agent reasoning, making it possible to understand not just what happened, but why.
Full audit trail
Every action is timestamped and linked to a session. The audit trail answers:
- Who (which agent/user) accessed what data?
- When did each tool call happen?
- What data was read or modified?
- Was the action authorized?
Grade System
Grades are assigned manually by the agent via obs_record_grade or automatically by the dashboard based on session statistics:
- A = Clean — No issues detected. Every tool call succeeded, token usage was efficient relative to task complexity, and the session completed its stated goal.
- B = Minor issues — Some inefficiencies (e.g., reading the same file twice, calling a tool that returned empty results and then trying it again). No failures.
- C = Inefficient — Needs attention. Redundant tool calls, excessive token consumption, or recoverable errors that were eventually resolved.
- D = Risky — Significant problems. Multiple failed tool calls, unusually high cost for the task, or the agent chose demonstrably wrong tools.
- F = Failed — Errors occurred that prevented task completion, or the agent abandoned the session.
Grades accumulate over time. The /api/stats endpoint shows your average grade and grade distribution.
Why This Exists
AI agents are a black box. You tell Claude Code or Cursor to fix a bug, refactor a module, or add a feature — and minutes later you have a diff. But what actually happened in between? How many tool calls did it make? How many tokens did it burn? Which files did it read? Did it try three approaches before landing on one? You have no idea.
This isn't just academic curiosity. Without observability:
- You can't estimate costs. A session that feels quick might have burned $5 in API calls. A session that felt slow might have cost $0.50. You're operating blind.
- You can't debug failures. The agent produced broken code — was it because it read the wrong file? Used a deprecated API? Misunderstood the task? Without traces, you're guessing.
- You can't improve your prompts. Is the agent reading too many files? Calling too many tools? Wasting tokens on irrelevant context? You need data to tune your system instructions.
- You can't audit access. If an agent reads a file containing secrets or API keys, you should know about it. If it makes an unexpected network call, you need to see it.
Agent Observability gives you a flight recorder for every agent session. It answers: what happened, why it happened, and what it cost.
Provenance
This project combines ideas from three prior projects:
AgentShelf (Shopify AI readiness scanner)
AgentShelf scans a Shopify store's theme, apps, admin settings, and custom code to produce an AI readiness score. As it scans, it builds a full audit trail — every file read, every API call made, every finding logged with a timestamp and data source. Pattern adopted here: structured audit trail with per-action timestamps, data source attribution, and session-level summarization.
Veros (FHIR clinical ground truth)
Veros generates synthetic longitudinal patient records (FHIR R4) and uses them to validate clinical decision support agents. Its core principle: "no trace, no answer." Every snippet of clinical reasoning produced by an AI must be traceable back to the specific data element (lab result, medication, condition) that supports it. Pattern adopted here: decision point tracking — every agent choice must cite its basis, making reasoning auditable and contestable.
MCP Observatory
MCP Observatory secures MCP servers — testing them for vulnerabilities, schema drift, and attack surfaces before agents depend on them. It's used by 850+ developers weekly and powers CI pipelines for MCP server security. Use Observatory to secure your MCP servers. Use agent-obs to trace the agents that depend on them. Observatory validates; agent-obs observes.
Pattern adopted here: tool health scoring, session grading (A-F), and automatic degradation flags.
Open Source vs Cloud
This open source package (agent-observability on npm) is the core engine. It's MIT licensed and will always remain free and local-first:
- CLI tools (proxy, server, dashboard)
- Local SQLite storage
- REST API
- MCP server tools
- Full audit trail, cost estimation, and session grading
A cloud version (app.agentobservability.dev) is in development with additional features:
- Team dashboards with shared session history
- Alerting (Slack/email when an agent's grade drops below C)
- Historical analytics (cost trends, efficiency trends over months)
- Role-based access control for audit trails
- SOC 2 compliant infrastructure
The open source package will always be able to run independently. The cloud version is additive, not a replacement.
License
MIT
来源:README.md,提交 2658eef
工具
0版本历史
1- v1.0.7最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分