智能体执行追踪_agent-tracing
以下为本文档的中文说明agent-tracing智能体追踪是LobeHub开发的一款零配置本地开发工具用于记录和检查AI智能体的执行快照。它通过CLI命令行界面提供对智能体每一步执行的细粒度洞察。在开发模式下AgentRuntimeService.executeStep()方法会自动将每一步执行记录为部分快照partial snapshots存储在.agent-tracing目录中当操作完成时这些部分快照会被合并为一个完整的ExecutionSnapshot JSON文件。该技能的数据流设计精巧执行步骤循环构建StepPresentationData写入部分快照到磁盘完成时最终化为时间戳加追踪ID命名的JSON文件。它会同时捕获上下文引擎数据包括agentDocuments、systemRole等重型负载这些数据通过旁路通道传递不进入Redis状态管道从而避免性能瓶颈。CLI提供了丰富的查看命令inspect查看追踪概览list列出所有快照并支持按步骤查看消息(-m)、工具调用(-t)、原始事件(-e)、运行时上下文(-c)等。开发者还可以使用–payload(-p)查看上下文引擎输入概览使用–memory(-M)查看注入的用户记忆。该技能特别适合调试复杂的多步骤AI智能体系统帮助开发者理解LLM的输入输出、工具调用流程和上下文引擎的工作方式。它提供了从原始数据到格式化输出的完整调试链路是智能体应用开发中不可或缺的诊断工具。Agent Tracing CLI Guidelobechat/agent-tracingis a zero-config local dev tool that records agent execution snapshots to disk and provides a CLI to inspect them.How It WorksInNODE_ENVdevelopment,AgentRuntimeService.executeStep()automatically records each step to.agent-tracing/as partial snapshots. When the operation completes, the partial is finalized into a completeExecutionSnapshotJSON file.Data flow: executeStep loop - buildStepPresentationData- write partial snapshot to disk - on completion, finalize to.agent-tracing/{timestamp}_{traceId}.jsonContext engine capture: InRuntimeExecutors.ts, thecall_llmexecutor callsctx.tracingContextEngine(input, output)afterserverMessagesEngine()processes messages.AgentRuntimeService.executeStepbuffers the call per step and forwards it toOperationTraceRecorder.appendStepas the typedcontextEnginefield. CE flows through this side channel rather than theeventsarray so its heavy payload (agentDocuments, systemRole, …) never enters the Redis state pipeline (LOBE-9110).Package Locationpackages/agent-tracing/ src/ types.ts # ExecutionSnapshot, StepSnapshot, SnapshotSummary store/ types.ts # ISnapshotStore interface file-store.ts # FileSnapshotStore (.agent-tracing/*.json) recorder/ index.ts # appendStepToPartial(), finalizeSnapshot() viewer/ index.ts # Terminal rendering: renderSnapshot, renderStepDetail, renderMessageDetail, renderSummaryTable, renderPayload, renderPayloadTools, renderMemory cli/ index.ts # CLI entry point (#!/usr/bin/env bun) inspect.ts # Inspect command (default) partial.ts # Partial snapshot commands (list, inspect, clean) index.ts # Barrel exportsData StorageCompleted snapshots:.agent-tracing/{ISO-timestamp}_{traceId-short}.jsonLatest symlink:.agent-tracing/latest.jsonIn-progress partials:.agent-tracing/_partial/{operationId}.jsonFileSnapshotStoreresolves fromprocess.cwd()—run CLI from the repo rootCLI CommandsAll commands run from therepo root:# View latest trace (tree overview, inspect is the default command)agent-tracing agent-tracing inspect agent-tracing inspecttraceIdagent-tracing inspect latest# List recent snapshotsagent-tracing list agent-tracing list-l20# Inspect specific step (-s is short for --step)agent-tracing inspecttraceId-s0# View messages (-m is short for --messages)agent-tracing inspecttraceId-s0-m# View full content of a specific message (by index shown in -m output)agent-tracing inspecttraceId-s0--msg2agent-tracing inspecttraceId-s0--msg-input1# View tool call/result details (-t is short for --tools)agent-tracing inspecttraceId-s1-t# View raw events (-e is short for --events)agent-tracing inspecttraceId-s0-e# View runtime context (-c is short for --context)agent-tracing inspecttraceId-s0-c# View context engine input overview (-p is short for --payload)agent-tracing inspecttraceId-pagent-tracing inspecttraceId-s0-p# View available tools in payload (-T is short for --payload-tools)agent-tracing inspecttraceId-Tagent-tracing inspecttraceId-s0-T# View user memory (-M is short for --memory)agent-tracing inspecttraceId-Magent-tracing inspecttraceId-s0-M# Raw JSON output (-j is short for --json)agent-tracing inspecttraceId-jagent-tracing inspecttraceId-s0-j# List in-progress partial snapshotsagent-tracing partial list# Inspect a partial (use inspect directly — all flags work with partial IDs)agent-tracing inspectpartialOperationIdagent-tracing inspectpartialOperationId-Tagent-tracing inspectpartialOperationId-p# Clean up stale partial snapshotsagent-tracing partial cleanInspect Flag Reference| Flag | Short | Description| Default Step || ----------------- | ----- | ------------------------------------------------------------------------------------------------- | ------------ ||--step n|-s| Target a specific step | — ||--messages|-m| Messages context (CE input → params → LLM payload) | — ||--tools|-t| Tool calls results (what agent invoked) | — ||--events|-e| Raw events (llm_start, llm_result, etc.) | — ||--context|-c| Runtime context payload (raw) | — ||--system-role|-r| Full system role content | 0 ||--env| | Environment context | 0 ||--payload|-p| Context engine input overview (model, knowledge, tools summary, memory summary, platform context) | 0 ||--payload-tools|-T| Available tools detail (plugin manifests LLM function definitions) | 0 ||--memory|-M| Full user memory (persona, identity, contexts, preferences, experiences) | 0 ||--diff n|-d| Diff against step N (use with-ror--env) | — ||--msg n| | Full content of message N from Final LLM Payload | — ||--msg-input n| | Full content of message N from Context Engine Input | — ||--json|-j| Output as JSON (combinable with any flag above) | — |Flags marked “Default Step: 0” auto-select step 0 if--stepis not provided. All flags supportlatestor omitted traceId.Typical Debug Workflow# 1. Trigger an agent operation in the dev UI# 2. See the overviewagent-tracing inspect# 3. List all traces, get traceIdagent-tracing list# 4. Quick overview of what was fed into context engineagent-tracing inspect-p# 5. Inspect a specific steps messages to see what was sent to the LLMagent-tracing inspect TRACE_ID-s0-m# 6. Drill into a truncated message for full contentagent-tracing inspect TRACE_ID-s0--msg2# 7. Check available tools vs actual tool callsagent-tracing inspect-T# available toolsagent-tracing inspect-s1-t# actual tool calls results# 8. Inspect user memory injected into the conversationagent-tracing inspect-M# 9. Diff system role between steps (multi-step agents)agent-tracing inspect TRACE_ID-r-d2Key TypesinterfaceExecutionSnapshot{traceId:string;operationId:string;model?:string;provider?:string;startedAt:number;completedAt?:number;completionReason?:|done|error|interrupted|max_steps|cost_limit|waiting_for_human;totalSteps:number;totalTokens:number;totalCost:number;error?:{type:string;message:string};steps:StepSnapshot[];}interfaceStepSnapshot{stepIndex:number;stepType:call_llm|call_tool;executionTimeMs:number;content?:string;// LLM outputreasoning?:string;// Reasoning/thinkinginputTokens?:number;outputTokens?:number;toolsCalling?:Array{apiName:string;identifier:string;arguments?:string};toolsResult?:Array{apiName:string;identifier:string;isSuccess?:boolean;output?:string;};messages?:any[];// DB messagesbefore step context?:{phase:string;payload?:unknown;stepContext?:unknown};events?:Array{type:string;[key:string]:unknown};contextEngine?:{input?:unknown;// contextEngineInput minus messages toolsConfig (reconstructible from baseline)output?:unknown;// processed messages array (final LLM payload)};}–messages Output StructureWhen using--messages, the output shows three sections (if context engine data is available):Context Engine Input— DB messages passed to the engine, with[0],[1], … indices. Use--msg-input Nto view full content.Context Engine Params— systemRole, model, provider, knowledge, tools, userMemory, etc.Final LLM Payload— Processed messages after context engine (system date injection, user memory, history truncation, etc.), with[0],[1], … indices. Use--msg Nto view full content.Integration PointsRecording:apps/server/src/services/agentRuntime/AgentRuntimeService.ts— in theexecuteStep()method, after buildingstepPresentationData, writes partial snapshot in dev modeContext engine capture:apps/server/src/modules/AgentRuntime/RuntimeExecutors.ts— incall_llmexecutor, afterserverMessagesEngine()returns, callsctx.tracingContextEngine(input, output).AgentRuntimeService.executeStepbuffers it per step and passes it totraceRecorder.appendStepas the typedcontextEnginefield (kept off theeventsarray to stay out of Redis state).Store:FileSnapshotStorereads/writes to.agent-tracing/relative toprocess.cwd()3d:[“,,,L40”,null,{“content”:“$41”,“frontMatter”:{“name”:“agent-tracing”,“description”:“Agent tracing CLI for execution snapshots. Use for agent-tracing, traces, snapshots, LLM call inspection, context engine data, agent step analysis, or execution debugging.”,“user-invocable”:false}}]3e:[“KaTeX parse error: Expected }, got EOF at end of input: …,children:[[”,“div”,null,{“className”:“flex items-center justify-between border-b border-border bg-muted/30 px-4 py-2.5”,“children”:[[“KaTeX parse error: Expected }, got EOF at end of input: …,children:[”,“span”,null,{“className”:“truncate text-xs font-medium text-muted-foreground”,“children”:“同仓库更多 Skills”}]}],[“KaTeX parse error: Expected EOF, got } at position 88: …ldren:同仓库}]]}̲],[”,“div”,null,{“className”:“p-4 sm:p-5”,“children”:[[“,h2,null,id:related−skills−heading,className:text−2xlfont−semiboldtracking−normaltext−foreground,children:同仓库更多Skills],[,h2,null,{id:related-skills-heading,className:text-2xl font-semibold tracking-normal text-foreground,children:同仓库更多 Skills}],[,h2,null,id:related−skills−heading,className:text−2xlfont−semiboldtracking−normaltext−foreground,children:同仓库更多Skills],[”,“div”,null,{“className”:“mt-4 grid gap-3 sm:grid-cols-2”,“children”:[“L42,L42,L42,L43”,“L44,L44,L44,L45”,“L46,L46,L46,L47”]}]]}]]}]48:I[206516,[“/_next/static/chunks/051aanbhrv4br.js”,“/_next/static/chunks/0mizr60h7ayzt.js”,“/_next/static/chunks/0v9lm1dmbdoo-.js”,“/_next/static/chunks/0rxr1j1j3j-.r.js”,“/_next/static/chunks/02ftybezfvqjd.js”,“/_next/static/chunks/0.v9ksvnnj8ia.js”,“/_next/static/chunks/0bn6id96nx3k.js,“/_next/static/chunks/13ybnhn37c.tc.js”,“/_next/static/chunks/0_fnrdtruz8uf.js”,“/_next/static/chunks/0r6l15utt1mwb.js”,“/_next/static/chunks/0dm9a5into854.js”,/_next/static/chunks/07k6hqoibtcn.js”,“/next/static/chunks/0b4cao.4y…j.js”,“/_next/static/chunks/02i-n28z7kjd0.js”],“default”]

相关新闻

手机状态栏图标隐藏的耗电与安全隐患解析

手机状态栏图标隐藏的耗电与安全隐患解析

1. 手机顶部图标隐藏的安全隐患 那天在地铁上,我无意间瞥见邻座小伙的手机顶部状态栏,密密麻麻排着七八个图标。出于职业习惯,我忍不住多看了两眼——好家伙,里面至少有三个图标代表着后台正在运行的高耗电应用。这让我想起自己刚…

2026/10/7 11:37:01 阅读更多 →
RNAi技术在MASH治疗中的突破与应用

RNAi技术在MASH治疗中的突破与应用

1. 项目概述:MASH赛道与瑞博生物的领先布局 在生物医药领域,代谢功能障碍相关脂肪性肝炎(MASH)已成为全球制药巨头竞相争夺的黄金赛道。作为一家专注于RNA疗法研发的创新型企业,瑞博生物(股票代码&#xff…

2026/10/10 18:15:06 阅读更多 →
5分钟掌握GIMP Resynthesizer:智能图像修复与纹理合成全攻略

5分钟掌握GIMP Resynthesizer:智能图像修复与纹理合成全攻略

5分钟掌握GIMP Resynthesizer:智能图像修复与纹理合成全攻略 【免费下载链接】resynthesizer Suite of gimp plugins for texture synthesis 项目地址: https://gitcode.com/gh_mirrors/re/resynthesizer 还在为照片中的瑕疵烦恼吗?还在为找不到合…

2026/10/13 20:43:17 阅读更多 →

最新新闻

从 1080P 到 4K:Video2X 的 Qt6 界面把视频超分辨率与帧插值做成四步

从 1080P 到 4K:Video2X 的 Qt6 界面把视频超分辨率与帧插值做成四步

从 1080P 到 4K:Video2X 的 Qt6 界面把视频超分辨率与帧插值做成四步 【免费下载链接】video2x A machine learning-based video super resolution and frame interpolation framework. Est. Hack the Valley II, 2018. 项目地址: https://gitcode.com/GitHub_Tre…

2026/10/14 5:16:02 阅读更多 →
用RAG盘活老师傅经验:制造业设备手册解析与故障诊断开源框架

用RAG盘活老师傅经验:制造业设备手册解析与故障诊断开源框架

制造业里攒文档的速度,永远赶不上老师傅退休的速度。我见过不少车间,设备手册摞起来半人高,故障代码表散落在三四个系统里,老师傅随口一句“这声音不对”,新来的维护工要翻半天手册才敢动手。我一直在琢磨怎么用RAG把这…

2026/10/14 5:16:02 阅读更多 →
工业AI落地制造现场:从缺陷检测到工艺优化的实战观察

工业AI落地制造现场:从缺陷检测到工艺优化的实战观察

这几年我跑了不少制造工厂,从汽车零部件、家电组装到电子产线,都待过一阵子。发现一个有趣的现象:“工业AI”这个词人人都在喊,真正把模型嵌进产线、天天跑数据的其实没多少。许多人把工业AI想象成科幻片里的机器人代替工人&#…

2026/10/14 5:16:02 阅读更多 →
C++与AI框架:从LibTorch部署到推理引擎的工程实战

C++与AI框架:从LibTorch部署到推理引擎的工程实战

1. 为什么AI圈子里C依然是硬通货在Python几乎统治了算法实验和模型训练脚本的今天,聊C与人工智能框架这个话题,听起来像是考古。但真正把AI系统推到生产环境的人,大概率都明白一个事实:Python是AI的壳,C才是AI的魂。先…

2026/10/14 5:16:02 阅读更多 →
codelin 统一 Claude Code 级别智能编程助手:UnifiedClaudeCodeAssistant 功能整合实现全解析

codelin 统一 Claude Code 级别智能编程助手:UnifiedClaudeCodeAssistant 功能整合实现全解析

人工智能大模型AI Agent代码智能体工具调用MCP 服务RAG交互助手 【免费下载链接】codelin 项目地址: https://gitcode.com/Cangjie-SIG/codelin 点击查看 免费下载 导读:本文以 codelin 智能编程助手的“统一功能整合”为主线,完整拆解其基于…

2026/10/14 5:16:02 阅读更多 →
Small Agent为何要从生成式推理转向分类式推理

Small Agent为何要从生成式推理转向分类式推理

1. 为什么“生成式推理”正在拖慢 Small Agent 的实际落地?你有没有遇到过这样的场景:一个轻量级的智能体(Small Agent),部署在边缘设备上,响应延迟要求低于200毫秒,但每次执行“判断用户意图”…

2026/10/14 5:15:02 阅读更多 →

日新闻

AnyPS5通用适配层设计:兼容性与性能的工程取舍

AnyPS5通用适配层设计:兼容性与性能的工程取舍

1. 从"AnyPS5"这个名字说起:它到底想解决什么问题第一次看到"AnyPS5"这个标题,我脑子里冒出来的第一个念头是:这大概率是一个围绕"跨平台运行"或者"通用适配"做文章的项目。名字里的"Any"…

2026/10/14 0:00:41 阅读更多 →
Flutter跨平台开发实战:二手交易应用与HarmonyOS适配

Flutter跨平台开发实战:二手交易应用与HarmonyOS适配

1. 项目概述:Flutter跨平台二手交易应用开发作为一名长期从事移动应用开发的工程师,我最近完成了一个基于Flutter框架的二手物品交易平台项目。这个项目最吸引我的地方在于它完美结合了Flutter的跨平台优势与HarmonyOS的生态特性,实现了"…

2026/10/14 0:00:41 阅读更多 →
DFS算法解决飞机降落调度问题实战

DFS算法解决飞机降落调度问题实战

1. 项目背景与核心思路飞机降落问题是一个经典的调度优化场景,也是算法竞赛和面试中的高频题目。这个题目要求我们合理安排多架飞机的降落顺序和时间,确保所有飞机都能安全着陆而不发生冲突。在实际航空管制中,这类问题直接关系到飞行安全和机…

2026/10/14 0:00:41 阅读更多 →

周新闻

流感时间序列预测实战:ARIMA/LSTM全流程拆解与避坑指南

流感时间序列预测实战:ARIMA/LSTM全流程拆解与避坑指南

简介:基于 ARIMA、LSTM、Transformer 等模型的流感时间序列预测 Python 源码,面向计算机相关专业课程设计与期末大作业学生,以及项目实战学习者。内容覆盖预处理、平稳性检验、定阶、残差分析、多模型对比预测的完整时序建模流程,…

2026/10/14 3:30:28 阅读更多 →
影刀RPA新手教程:键盘模拟输入实战——输入文本与模拟按键的区别

影刀RPA新手教程:键盘模拟输入实战——输入文本与模拟按键的区别

影刀RPA新手教程:键盘模拟输入实战——输入文本与模拟按键的区别 做影刀RPA自动化,十个新手有八个栽在"往输入框里填东西"这件事上:要么填不进去,要么填了一半,要么直接把原来内容追加在后面。这背后的根因&…

2026/10/13 16:22:04 阅读更多 →
影刀RPA新手教程:阅文起点小说数据采集实战——书籍信息与章节内容

影刀RPA新手教程:阅文起点小说数据采集实战——书籍信息与章节内容

影刀RPA新手教程:阅文起点小说数据采集实战——书籍信息与章节内容 1. 认识影刀:什么场景该用RPA采小说数据 起点中文网的页面结构相对稳定——分类榜单、书籍详情、章节内容三块独立页面,跳转链路清晰。这种场景非常适合影刀自动化&#x…

2026/10/14 3:29:58 阅读更多 →

月新闻

我发现了一个新思路:用 Remotion + Claude Code 像写代码一样自动化生成短视频

我发现了一个新思路:用 Remotion + Claude Code 像写代码一样自动化生成短视频

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

2026/10/13 22:01:27 阅读更多 →
Windows下 Codex 中 Chrome 和 Computer Use 插件不可用问题排查及解决参考方式:TaoToken 统一 Key 配置与验证

Windows下 Codex 中 Chrome 和 Computer Use 插件不可用问题排查及解决参考方式:TaoToken 统一 Key 配置与验证

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

2026/10/13 14:57:39 阅读更多 →
黑夜航拍船只数据集训练YOLOV5模型全流程解析

黑夜航拍船只数据集训练YOLOV5模型全流程解析

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

2026/10/12 18:11:17 阅读更多 →