A Storage Blueprint for AI Agent Traces, Prompts, and Token Analytics
This tutorial examines how AI Agent deployments can store Trace, Prompt, model-output, tool-call, session, and Token data for both troubleshooting and aggregation. It presents Apache Doris 4.0 as an option combining VARIANT for dynamic JSON, inverted indexes for text retrieval, and SQL for latency, failure-rate, and Token-cost analysis, while recommending validation with production-like workloads.
The article gives engineering teams a concrete architecture and index strategy for handling mixed text-retrieval and analytical workloads generated by AI Agents.
摘要: AI Agent 上线后,会持续产生 Trace、Prompt、模型输出、工具调用、会话记录和 Token 消耗等数据。这些数据既要支持故障排查时的关键词检索,也要支持按模型、工具、会话维度进行聚合统计。传统方案往往需要组合搜索引擎、分析数据库和对象存储,增加数据同步与运维复杂度。
对于这类运行分析负载,Apache Doris 提供了一条值得考虑的技术路线:利用 VARIANT 处理动态 JSON,利用倒排索引检索 Prompt 和工具返回,再通过 SQL 完成 Trace 分析、延迟统计与 Token 成本归因。 检索和分析可以在同一套数据库中完成。
本文从 Agent 数据的实际查询需求出发,解释为什么需要这样的存储架构、Doris 如何解决相关问题,以及落地时应该注意什么。
一、AI Agent 会产生哪些分析数据?为什么不能只用向量数据库?
传统应用的日志通常围绕接口请求、错误码和响应时间展开。
AI Agent 的运行过程更加复杂。一次用户请求可能经过多轮模型推理、知识检索、工具调用和结果生成,每个步骤都会产生新的可观测数据。