执行 API

执行表示代理运行的实例。每个执行捕获消息、工具使用、结果和性能指标的完整历史。使用执行 API 来监控代理活动、跟踪任务完成并分析执行模式。

基础 URL: https://us.teamday.ai/api/v1/executions

身份验证: 需要个人访问令牌


端点概述

方法端点描述状态
GET/executions列出执行🟡 未测试
GET/executions/[id]获取执行详情🟡 未测试
GET/executions/[id]/tree获取执行树(子代理)🟡 未测试
POST/executions/[id]/cancel取消运行中的执行🟡 未测试

实现状态: 完成但未在生产中测试


执行对象

属性

{
  id: string              // 执行 ID(格式:exec_xxx)
  agentId: string         // 执行的代理
  organizationId: string  // 所有者组织
  userId: string          // 触发执行的用户
  status: string          // "pending" | "running" | "completed" | "failed" | "cancelled"
  startedAt: string       // ISO 8601 时间戳
  completedAt?: string    // ISO 8601 时间戳(如果已完成)
  messages: Message[]     // 对话历史
  toolCalls: ToolCall[]   // 执行期间使用的工具
  error?: string          // 错误消息(如果失败)
  metadata: object        // 其他执行上下文
}

示例对象

{
  "id": "exec_xyz789",
  "agentId": "agent_abc123",
  "organizationId": "org_456",
  "userId": "user_789",
  "status": "completed",
  "startedAt": "2025-12-09T10:30:00Z",
  "completedAt": "2025-12-09T10:30:45Z",
  "messages": [
    {
      "role": "user",
      "content": "Analyze this sales data",
      "timestamp": "2025-12-09T10:30:00Z"
    },
    {
      "role": "assistant",
      "content": "Based on the sales data analysis...",
      "timestamp": "2025-12-09T10:30:45Z"
    }
  ],
  "toolCalls": [
    {
      "tool": "read_file",
      "arguments": { "path": "sales_data.csv" },
      "result": "Success",
      "timestamp": "2025-12-09T10:30:20Z"
    }
  ],
  "metadata": {}
}