[知识进化] Agent 执行日志结构化提取 #59

Closed
opened 2026-05-10 15:32:18 +08:00 by admin · 0 comments
Owner

目标

将每个 Agent 的每次执行结构化为可分析的数据。

结构化字段

  • agent_id / agent_name / agent_version
  • goal_id / task_id(关联上下文)
  • input: 用户输入完整文本
  • output: Agent 输出完整文本
  • tool_chain: [{tool_name, input, output, duration_ms}]
  • llm_calls: [{model, prompt_tokens, completion_tokens, duration_ms}]
  • success: bool
  • error_message: str
  • user_feedback: {rating, comment}
  • latency_ms: 总耗时

技术方案

  • AgentRuntime.run() 返回值扩展为 ExecutionLog
  • 写入独立表 agent_execution_logs
  • 异步写入(Celery task)

新增文件

  • backend/app/models/agent_execution_log.py
  • backend/app/services/execution_logger.py
  • Alembic 迁移
## 目标 将每个 Agent 的每次执行结构化为可分析的数据。 ## 结构化字段 - agent_id / agent_name / agent_version - goal_id / task_id(关联上下文) - input: 用户输入完整文本 - output: Agent 输出完整文本 - tool_chain: [{tool_name, input, output, duration_ms}] - llm_calls: [{model, prompt_tokens, completion_tokens, duration_ms}] - success: bool - error_message: str - user_feedback: {rating, comment} - latency_ms: 总耗时 ## 技术方案 - AgentRuntime.run() 返回值扩展为 ExecutionLog - 写入独立表 agent_execution_logs - 异步写入(Celery task) ## 新增文件 - backend/app/models/agent_execution_log.py - backend/app/services/execution_logger.py - Alembic 迁移
admin closed this issue 2026-05-10 17:58:10 +08:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: admin/aiagent#59