Summary: A developer reported that connecting a database to an AI Agent for queries and file exports caused massive token consumption, even with workflows stored in Memory. The solution: split tasks so the LLM only translates natural language to SQL, while Python/Shell scripts handle execution, formatting, and file uploads. Embedding table structure descriptions and SQL templates in the Skill further reduces reasoning overhead.
Why it matters: This pattern lets builders avoid wasting tokens on steps that don't need AI reasoning. Implement Agent Skill with script-based execution to cut costs and improve reliability for database-driven agents.
原文 (Original):
Q:我把数据库接入了 AI Agent,每次用手机发消息让它帮我查数据、导出文件,但 token 消耗特别大。我已经把工作流写进了 Agent 的 Memory 里,但它就是不按流程走,该怎么办? A:这是一个非常典型的问题。根本原因在于:Memory 只是“背景信息”,不是“执行指令”。Agent 每次对话都会重新理解意图、重新规划步骤,这个思考过程本身就是 token 消耗的大头。 解决方案: