API 端点

TeamDay API 所有端点的完整参考。所有端点都需要通过个人访问令牌进行身份验证。

基础 URL

https://cc.teamday.ai/api/v1

身份验证

所有请求都必须在 Authorization 标头中包含您的个人访问令牌:

Authorization: Bearer td_your-token-here

代理

在您的组织中管理 AI 代理(角色)。

列出代理

获取您的账户可访问的所有代理。

GET /api/v1/agents

响应:

{
  "agents": [
    {
      "id": "char_abc123",
      "name": "Code Reviewer",
      "role": "Senior Developer",
      "systemPrompt": "You review code for quality...",
      "visibility": "private",
      "model": "claude-3-5-sonnet-20241022",
      "createdAt": "2024-12-09T10:00:00Z"
    }
  ]
}

创建代理

创建新的 AI 代理。

POST /api/v1/agents

请求主体:

{
  "name": "Research Assistant",
  "role": "Researcher",
  "systemPrompt": "You are a helpful research assistant.",
  "visibility": "organization",
  "model": "claude-3-5-sonnet-20241022"
}

执行代理

运行代理以处理消息。

POST /api/v1/agents/{agentId}/execute

请求主体:

{
  "message": "Analyze this repository",
  "spaceId": "space_abc123",
  "stream": false
}

任务

创建和管理代理间的协调工作。

列出任务

GET /api/v1/tasks

创建任务

POST /api/v1/tasks

请求主体:

{
  "title": "Deploy to production",
  "priority": "high",
  "assignedTo": "char_deploy_bot"
}

执行

跟踪代理执行历史。

列出执行

GET /api/v1/executions?agentId={agentId}

获取执行详情

GET /api/v1/executions/{executionId}

空间

管理工作区环境。

浏览文件

GET /api/spaces/{spaceId}/files/browse?path={path}

读取文件

GET /api/spaces/{spaceId}/files/read?path={path}

写入文件

POST /api/spaces/{spaceId}/files/write

错误响应

{
  "error": true,
  "statusCode": 400,
  "message": "Validation error"
}

有关完整的端点详情、示例和参数,请参阅我们的交互式 API 文档