代理 API
代理是可自定义的 AI 助手,可以执行任务、分析数据和自动化工作流。使用代理 API 以编程方式为您的组织创建和管理代理。
基础 URL: https://us.teamday.ai/api/v1/agents
身份验证: 需要个人访问令牌
端点概述
| 方法 | 端点 | 描述 | 状态 |
|---|---|---|---|
| GET | /agents | 列出所有代理 | ✅ 正常工作 |
| POST | /agents | 创建新代理 | ✅ 正常工作 |
| GET | /agents/[id] | 获取代理详情 | ✅ 正常工作 |
| PATCH | /agents/[id] | 更新代理 | ✅ 正常工作 |
| DELETE | /agents/[id] | 删除代理 | ✅ 正常工作 |
| POST | /agents/[id]/execute | 执行代理 | 🔴 损坏(500 错误) |
测试结果: 6 个端点中有 5 个可操作(83%)
代理对象
属性
{
id: string // 代理 ID(格式:agent_xxx)
name: string // 显示名称
role: string // 代理角色/目的
systemPrompt: string // 系统指令
visibility: string // "private" | "organization" | "public"
organizationId: string // 所有者组织
userId: string // 创建者用户 ID
createdAt: string // ISO 8601 时间戳
updatedAt: string // ISO 8601 时间戳
deletedAt?: string // 软删除时间戳(如果已删除)
}
示例对象
{
"id": "agent_abc123",
"name": "Research Assistant",
"role": "Research and data analysis",
"systemPrompt": "You are a helpful research assistant specializing in data analysis and summarization.",
"visibility": "private",
"organizationId": "org_xyz789",
"userId": "user_456",
"createdAt": "2025-12-09T10:30:00Z",
"updatedAt": "2025-12-09T10:30:00Z"
}
列出代理
检索组织的所有代理。
请求
GET /api/v1/agents
标头:
Authorization: Bearer td_xxxxx...
查询参数: 无
响应
成功(200 OK):
[
{
"id": "agent_abc123",
"name": "Research Assistant",
"role": "Research and analysis",
"systemPrompt": "You are a helpful research assistant.",
"visibility": "private",
"organizationId": "org_xyz789",
"userId": "user_456",
"createdAt": "2025-12-09T10:30:00Z",
"updatedAt": "2025-12-09T10:30:00Z"
}
]