twill-cloud-coding-agent
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTwill Cloud Coding Agent
Twill Cloud Coding Agent
Use this skill to run Twill workflows through the public API.
v1使用此技能通过公开的 API运行Twill工作流。
v1Setup
配置
Set API key and optional base URL:
bash
export TWILL_API_KEY="your_api_key"
export TWILL_BASE_URL="${TWILL_BASE_URL:-https://twill.ai}"All API calls use:
Authorization: Bearer $TWILL_API_KEYUse this helper to reduce repetition:
bash
api() {
curl -sS "$@" \
-H "Authorization: Bearer $TWILL_API_KEY" \
-H "Content-Type: application/json"
}设置API密钥和可选的基础URL:
bash
export TWILL_API_KEY="your_api_key"
export TWILL_BASE_URL="${TWILL_BASE_URL:-https://twill.ai}"所有API调用均使用:
Authorization: Bearer $TWILL_API_KEY使用以下辅助工具减少重复代码:
bash
api() {
curl -sS "$@" \
-H "Authorization: Bearer $TWILL_API_KEY" \
-H "Content-Type: application/json"
}Endpoint Coverage (Public v1)
端点覆盖范围(公开v1版本)
GET /api/v1/auth/meGET /api/v1/repositoriesPOST /api/v1/tasksGET /api/v1/tasksGET /api/v1/tasks/:taskIdOrSlugPOST /api/v1/tasks/:taskIdOrSlug/messagesGET /api/v1/tasks/:taskIdOrSlug/jobsPOST /api/v1/tasks/:taskIdOrSlug/approve-planPOST /api/v1/tasks/:taskIdOrSlug/cancelPOST /api/v1/tasks/:taskIdOrSlug/archiveGET /api/v1/tasks/:taskIdOrSlug/teleport/claudeGET /api/v1/jobs/:jobId/logs/streamPOST /api/v1/jobs/:jobId/cancelGET /api/v1/scheduled-tasksPOST /api/v1/scheduled-tasksGET /api/v1/scheduled-tasks/:scheduledTaskIdPATCH /api/v1/scheduled-tasks/:scheduledTaskIdDELETE /api/v1/scheduled-tasks/:scheduledTaskIdPOST /api/v1/scheduled-tasks/:scheduledTaskId/pausePOST /api/v1/scheduled-tasks/:scheduledTaskId/resume
GET /api/v1/auth/meGET /api/v1/repositoriesPOST /api/v1/tasksGET /api/v1/tasksGET /api/v1/tasks/:taskIdOrSlugPOST /api/v1/tasks/:taskIdOrSlug/messagesGET /api/v1/tasks/:taskIdOrSlug/jobsPOST /api/v1/tasks/:taskIdOrSlug/approve-planPOST /api/v1/tasks/:taskIdOrSlug/cancelPOST /api/v1/tasks/:taskIdOrSlug/archiveGET /api/v1/tasks/:taskIdOrSlug/teleport/claudeGET /api/v1/jobs/:jobId/logs/streamPOST /api/v1/jobs/:jobId/cancelGET /api/v1/scheduled-tasksPOST /api/v1/scheduled-tasksGET /api/v1/scheduled-tasks/:scheduledTaskIdPATCH /api/v1/scheduled-tasks/:scheduledTaskIdDELETE /api/v1/scheduled-tasks/:scheduledTaskIdPOST /api/v1/scheduled-tasks/:scheduledTaskId/pausePOST /api/v1/scheduled-tasks/:scheduledTaskId/resume
Auth and Discovery
身份验证与发现
Validate key and workspace context:
bash
curl -sS "$TWILL_BASE_URL/api/v1/auth/me" \
-H "Authorization: Bearer $TWILL_API_KEY"List available GitHub repositories for the workspace:
bash
curl -sS "$TWILL_BASE_URL/api/v1/repositories" \
-H "Authorization: Bearer $TWILL_API_KEY"验证密钥和工作区上下文:
bash
curl -sS "$TWILL_BASE_URL/api/v1/auth/me" \
-H "Authorization: Bearer $TWILL_API_KEY"列出工作区可用的GitHub代码仓库:
bash
curl -sS "$TWILL_BASE_URL/api/v1/repositories" \
-H "Authorization: Bearer $TWILL_API_KEY"Tasks
任务
Create Task
创建任务
bash
api -X POST "$TWILL_BASE_URL/api/v1/tasks" \
-d '{"command":"Fix flaky tests in CI","repository":"owner/repo","userIntent":"SWE"}'Required fields:
command- (
repositoryor full GitHub URL)owner/repo
Optional fields:
branch- (provider or provider/model, for example
agentorcodex)codex/gpt-5.2 - (
userIntent,SWE,PLAN,ASK) — defaults toDEV_ENVIRONMENTSWE title- (array of
files){ filename, mediaType, url }
Always report back to the user.
task.urlbash
api -X POST "$TWILL_BASE_URL/api/v1/tasks" \
-d '{"command":"Fix flaky tests in CI","repository":"owner/repo","userIntent":"SWE"}'必填字段:
command- (
repository格式或完整GitHub URL)owner/repo
可选字段:
branch- (提供商或提供商/模型,例如
agent或codex)codex/gpt-5.2 - (
userIntent、SWE、PLAN、ASK)——默认值为DEV_ENVIRONMENTSWE title- (
files构成的数组){ filename, mediaType, url }
请始终将返回给用户。
task.urlList Tasks
列出任务
bash
curl -sS "$TWILL_BASE_URL/api/v1/tasks?limit=20&cursor=BASE64_CURSOR" \
-H "Authorization: Bearer $TWILL_API_KEY"Supports cursor pagination via and .
limitcursorbash
curl -sS "$TWILL_BASE_URL/api/v1/tasks?limit=20&cursor=BASE64_CURSOR" \
-H "Authorization: Bearer $TWILL_API_KEY"支持通过和进行游标分页。
limitcursorGet Task Details
获取任务详情
bash
curl -sS "$TWILL_BASE_URL/api/v1/tasks/TASK_ID_OR_SLUG" \
-H "Authorization: Bearer $TWILL_API_KEY"Returns task metadata plus including status, type, plan content, and plan outcome when available.
latestJobbash
curl -sS "$TWILL_BASE_URL/api/v1/tasks/TASK_ID_OR_SLUG" \
-H "Authorization: Bearer $TWILL_API_KEY"返回任务元数据以及(包括状态、类型、计划内容和可用的计划结果)。
latestJobSend Follow-Up Message
发送跟进消息
bash
api -X POST "$TWILL_BASE_URL/api/v1/tasks/TASK_ID_OR_SLUG/messages" \
-d '{"message":"Please prioritize login flow first","userIntent":"PLAN"}'userIntentfilesbash
api -X POST "$TWILL_BASE_URL/api/v1/tasks/TASK_ID_OR_SLUG/messages" \
-d '{"message":"Please prioritize login flow first","userIntent":"PLAN"}'userIntentfilesList Task Jobs
列出任务作业
bash
curl -sS "$TWILL_BASE_URL/api/v1/tasks/TASK_ID_OR_SLUG/jobs?limit=30&cursor=BASE64_CURSOR" \
-H "Authorization: Bearer $TWILL_API_KEY"Supports cursor pagination:
- defaults to
limit(max30)100 - fetches older pages
cursor - response includes and
jobsnextCursor
bash
curl -sS "$TWILL_BASE_URL/api/v1/tasks/TASK_ID_OR_SLUG/jobs?limit=30&cursor=BASE64_CURSOR" \
-H "Authorization: Bearer $TWILL_API_KEY"支持游标分页:
- 默认值为
limit(最大值30)100 - 用于获取更早的页面
cursor - 响应包含和
jobsnextCursor
Approve Plan
批准计划
Use when the latest plan job is completed and ready for approval.
bash
api -X POST "$TWILL_BASE_URL/api/v1/tasks/TASK_ID_OR_SLUG/approve-plan" \
-d '{}'当最新的计划作业完成并准备好批准时使用。
bash
api -X POST "$TWILL_BASE_URL/api/v1/tasks/TASK_ID_OR_SLUG/approve-plan" \
-d '{}'Cancel Task
取消任务
bash
api -X POST "$TWILL_BASE_URL/api/v1/tasks/TASK_ID_OR_SLUG/cancel" -d '{}'bash
api -X POST "$TWILL_BASE_URL/api/v1/tasks/TASK_ID_OR_SLUG/cancel" -d '{}'Archive Task
归档任务
bash
api -X POST "$TWILL_BASE_URL/api/v1/tasks/TASK_ID_OR_SLUG/archive" -d '{}'bash
api -X POST "$TWILL_BASE_URL/api/v1/tasks/TASK_ID_OR_SLUG/archive" -d '{}'Jobs
作业
Stream Job Logs (SSE)
流式传输作业日志(SSE)
bash
curl -N "$TWILL_BASE_URL/api/v1/jobs/JOB_ID/logs/stream" \
-H "Authorization: Bearer $TWILL_API_KEY" \
-H "Accept: text/event-stream"Stream emits JSON payloads in lines and terminates with a event.
data:completebash
curl -N "$TWILL_BASE_URL/api/v1/jobs/JOB_ID/logs/stream" \
-H "Authorization: Bearer $TWILL_API_KEY" \
-H "Accept: text/event-stream"流会在行中发送JSON负载,并在事件时终止。
data:completeCancel Job
取消作业
bash
api -X POST "$TWILL_BASE_URL/api/v1/jobs/JOB_ID/cancel" -d '{}'bash
api -X POST "$TWILL_BASE_URL/api/v1/jobs/JOB_ID/cancel" -d '{}'Scheduled Tasks
定时任务
List and Create
列出与创建
bash
curl -sS "$TWILL_BASE_URL/api/v1/scheduled-tasks" \
-H "Authorization: Bearer $TWILL_API_KEY"
api -X POST "$TWILL_BASE_URL/api/v1/scheduled-tasks" -d '{
"title":"Daily triage",
"message":"Review urgent issues and open tasks",
"repositoryUrl":"https://github.com/org/repo",
"baseBranch":"main",
"cronExpression":"0 9 * * 1-5",
"timezone":"America/New_York",
"agentProviderId":"claude-code/sonnet"
}'Required: , , , , .
titlemessagerepositoryUrlbaseBranchcronExpressionOptional: (defaults to ), (provider/model override).
timezone"UTC"agentProviderIdbash
curl -sS "$TWILL_BASE_URL/api/v1/scheduled-tasks" \
-H "Authorization: Bearer $TWILL_API_KEY"
api -X POST "$TWILL_BASE_URL/api/v1/scheduled-tasks" -d '{
"title":"Daily triage",
"message":"Review urgent issues and open tasks",
"repositoryUrl":"https://github.com/org/repo",
"baseBranch":"main",
"cronExpression":"0 9 * * 1-5",
"timezone":"America/New_York",
"agentProviderId":"claude-code/sonnet"
}'必填项:、、、、。
titlemessagerepositoryUrlbaseBranchcronExpression可选项:(默认值为)、(覆盖提供商/模型)。
timezone"UTC"agentProviderIdRead, Update, Delete
读取、更新、删除
bash
curl -sS "$TWILL_BASE_URL/api/v1/scheduled-tasks/SCHEDULED_TASK_ID" \
-H "Authorization: Bearer $TWILL_API_KEY"
api -X PATCH "$TWILL_BASE_URL/api/v1/scheduled-tasks/SCHEDULED_TASK_ID" -d '{
"message":"Updated instructions",
"cronExpression":"0 10 * * 1-5",
"agentProviderId":"codex/gpt-5.2"
}'
curl -sS -X DELETE "$TWILL_BASE_URL/api/v1/scheduled-tasks/SCHEDULED_TASK_ID" \
-H "Authorization: Bearer $TWILL_API_KEY"bash
curl -sS "$TWILL_BASE_URL/api/v1/scheduled-tasks/SCHEDULED_TASK_ID" \
-H "Authorization: Bearer $TWILL_API_KEY"
api -X PATCH "$TWILL_BASE_URL/api/v1/scheduled-tasks/SCHEDULED_TASK_ID" -d '{
"message":"Updated instructions",
"cronExpression":"0 10 * * 1-5",
"agentProviderId":"codex/gpt-5.2"
}'
curl -sS -X DELETE "$TWILL_BASE_URL/api/v1/scheduled-tasks/SCHEDULED_TASK_ID" \
-H "Authorization: Bearer $TWILL_API_KEY"Pause and Resume
暂停与恢复
bash
api -X POST "$TWILL_BASE_URL/api/v1/scheduled-tasks/SCHEDULED_TASK_ID/pause" -d '{}'
api -X POST "$TWILL_BASE_URL/api/v1/scheduled-tasks/SCHEDULED_TASK_ID/resume" -d '{}'bash
api -X POST "$TWILL_BASE_URL/api/v1/scheduled-tasks/SCHEDULED_TASK_ID/pause" -d '{}'
api -X POST "$TWILL_BASE_URL/api/v1/scheduled-tasks/SCHEDULED_TASK_ID/resume" -d '{}'Behavior
行为规范
- Use (
userIntent,SWE,PLAN,ASK) when calling API endpoints directly.DEV_ENVIRONMENT - Create task, report , and only poll/stream logs when requested.
task.url - Ask for if missing.
TWILL_API_KEY - Do not print API keys or other secrets.
- 直接调用API端点时,请使用(
userIntent、SWE、PLAN、ASK)。DEV_ENVIRONMENT - 创建任务后,返回,仅在用户请求时轮询/流式传输日志。
task.url - 如果缺少,请询问用户。
TWILL_API_KEY - 请勿打印API密钥或其他敏感信息。