智能体执行追踪_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/7/21 9:13:30 阅读更多 →
RNAi技术在MASH治疗中的突破与应用

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

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

2026/7/21 9:13:30 阅读更多 →
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/7/21 9:13:30 阅读更多 →

最新新闻

电子工程原理图设计规范与最佳实践

电子工程原理图设计规范与最佳实践

1. 原理图设计的重要性与基础认知在电子工程领域,原理图就像建筑师的蓝图,是连接创意与实物的关键桥梁。我从业十余年,见过太多因为原理图不规范导致的惨痛教训——从简单的PCB返工到整批产品召回。一张规范的原理图不仅能准确传达设计意图&a…

2026/7/22 4:35:32 阅读更多 →
电动汽车高压互锁系统原理与维修实战

电动汽车高压互锁系统原理与维修实战

1. 高压互锁系统:电动汽车安全的隐形守护者第一次拆解比亚迪秦EV的高压系统时,那个不起眼的橙色小插头引起了我的注意。这个看似普通的连接器,实际上是整车高压安全体系中最精妙的设计之一——高压互锁回路(High Voltage Interloc…

2026/7/22 4:35:32 阅读更多 →
RAG与中间件技术:AI应用开发新范式

RAG与中间件技术:AI应用开发新范式

1. RAG与中间件技术解析在LangChain生态中,检索增强生成(RAG)与中间件的结合正在重塑AI应用的开发范式。这种技术组合不仅解决了传统大语言模型的知识局限性问题,还通过模块化设计实现了业务流程的灵活编排。1.1 RAG核心机制RAG系统的工作流程可以分解为…

2026/7/22 4:35:32 阅读更多 →
我把 AI 小红书卡片生成做了一次内核升级:从固定版式套壳到内容驱动的动态构图

我把 AI 小红书卡片生成做了一次内核升级:从固定版式套壳到内容驱动的动态构图

小红书 AI 卡片生成内核升级:从固定版式套壳到内容驱动的动态构图 做 AI 小红书卡片生成的人,大概率都走过同一条弯路: 先设计 5~10 套精美的版式模板,然后让 AI 把不同的内容"套"进去。 这套方法的天花板很低。你很…

2026/7/22 4:35:32 阅读更多 →
C++构建金融大模型:从Transformer架构到指令微调的工程实践

C++构建金融大模型:从Transformer架构到指令微调的工程实践

1. 项目概述:从零构建一个金融领域的智能大脑最近和几个在投行和量化基金的朋友聊天,大家都在感慨,虽然通用大模型(LLM)很火,但在处理专业的金融问题时,总感觉隔靴搔痒。让它分析一份财报&#…

2026/7/22 4:35:31 阅读更多 →
ARM day5

ARM day5

1. 什么是 GIC?🔸 GIC 全称GIC(Generic Interrupt Controller,通用中断控制器),是 ARM 公司专门为 Cortex-A 系列 内核设计的一款集中式中断控制器。🔸 为什么需要 GIC?随着 SoC&…

2026/7/22 4:34:31 阅读更多 →

日新闻

TI DSP系统配置模块SYSCFG详解:中断机制与主设备优先级配置实战

TI DSP系统配置模块SYSCFG详解:中断机制与主设备优先级配置实战

1. 项目概述与SYSCFG模块的核心价值在嵌入式系统,尤其是像TI C6000系列这样的高性能DSP开发中,我们常常会与芯片手册里那些密密麻麻的寄存器打交道。很多开发者可能更关注算法实现、内存优化或者外设驱动,但对于一个稳定、高效的系统而言&…

2026/7/22 0:00:26 阅读更多 →
微信Server酱:高到达率的应急通知方案实践

微信Server酱:高到达率的应急通知方案实践

1. 为什么我们需要"最次"的通知方案? 在数字化协作环境中,消息通知系统的重要性不言而喻明。但现实情况是,企业级通知方案往往需要复杂的API对接(如企业微信、钉钉、飞书),个人开发者的小项目又经…

2026/7/22 0:00:26 阅读更多 →
甲方要的“简洁“PPT,到底是简洁还是省事?

甲方要的“简洁“PPT,到底是简洁还是省事?

甲方说"简洁一点",乙方听到的是"少做几页"。甲方说"不要太复杂",乙方理解成"别放图表了"。结果交过去,甲方说"我说的简洁不是这个意思"。"简洁"这个词在PPT语境里,是…

2026/7/22 0:00:26 阅读更多 →

周新闻

Go语言静态资源打包方案对比与实践指南

Go语言静态资源打包方案对比与实践指南

1. 项目背景与核心需求在Go语言开发中,我们经常需要处理静态资源文件的打包问题。无论是Web应用的模板文件、前端资源,还是配置文件、证书等,都需要随程序一起分发。传统做法是将这些文件与编译后的二进制文件放在同一目录下,但这…

2026/7/21 8:48:31 阅读更多 →
Go语言实现高性能LDAP认证服务的架构与实践

Go语言实现高性能LDAP认证服务的架构与实践

1. 项目背景与核心价值LDAP(轻量级目录访问协议)作为企业级身份认证的黄金标准,已经服务了超过80%的财富500强公司。我在金融科技领域实施统一认证体系时,发现传统Java方案存在启动慢、内存占用高等痛点。而Go语言凭借其协程并发模…

2026/7/21 5:34:47 阅读更多 →
【AI面试官实战指南】:用ChatGPT模拟10类高频技术岗面试,3天提升应答精准度92%

【AI面试官实战指南】:用ChatGPT模拟10类高频技术岗面试,3天提升应答精准度92%

更多请点击: https://intelliparadigm.com 第一章:AI面试官实战指南的核心价值与适用场景 AI面试官并非替代人类HR的“黑箱工具”,而是以可解释、可审计、可迭代的方式,赋能招聘全链路的关键基础设施。其核心价值在于将主观经验沉…

2026/7/21 8:25:39 阅读更多 →

月新闻