Tasks API
Reports during Agent execution, queries the current task, and notifies assignees. User-side Issue operations are not part of this API.
/api/tasks only handles actions during Agent execution. User operations such as the requirement list, Issue status, and manual reviews are documented in the Issues API.
Endpoints
| Method | Path | Purpose | Authentication |
|---|---|---|---|
POST |
/api/tasks/notify |
Notify the assignee, assign the task, or change the assignee | tk_ |
POST |
/api/tasks/complete |
Report the execution result from the Agent | tk_ / API key / JWT |
GET |
/api/tasks/current |
Get the current execution instance | tk_ |
GET |
/api/tasks/preflight |
Preflight the VCS credential for a repository (repo_key); 424 + error_code when it must be configured first |
tk_ / API key / JWT |
For general authentication and error formats, see Authentication and credentials.
POST /api/tasks/notify
Notifies the task assignee or transfers the task to another person or bot.
Authentication: tk_ session tokens only. grape_ API keys and web JWTs return 403.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
assignee |
string | Yes | Assignee username |
repo_key |
string | Yes | Repository, such as owner/repo |
issue_number |
int | Yes | Issue number, not PR number |
task_description |
string | No | Task description |
Request example
curl -fsS -X POST "$GRAPE_BASE_URL/api/tasks/notify" \
-H @~/.grape.auth -H 'Content-Type: application/json' \
-d '{"assignee":"<username>","repo_key":"<owner>/<repo>","issue_number":1}'
Successful response
{"ok":true,"issue_id":5,"task_id":5,"message":"Task created and assignee notified"}
Common errors
| Status | Cause |
|---|---|
| 400 | Missing assignee, repo_key, or issue_number |
| 401 | Unauthenticated or invalid token |
| 403 | Not a tk_ token, or cross-repository scope is not allowed |
| 404 | Repository is not hosted |
POST /api/tasks/complete
The Agent reports the conclusion of an execution instance. When called with a tk_ token, task_id may be omitted; the server locates the task from the session.
Authentication: All three credential types are accepted.
Request body (key fields)
| Field | Type | Required | Description |
|---|---|---|---|
task_id |
string | Required with an API key or JWT | May be omitted with a session token |
result_text |
string | Required for unstructured results | Conclusion or output summary |
next_step |
string | No | a2a_issue / reply_comment / a2a_need_clarify / done |
actions |
string[] | No | List of actions |
conclusion |
string | No | Conclusion |
artifacts |
string[] | No | Output identifiers, such as a PR or commit |
issue_summary |
string | No | One-sentence summary |
issue_number |
int | Required for external reports | Target Issue number |
node |
string | Required for external reports | Target node |
repository |
string | Required for external reports | owner/repo |
Structured example
{
"actions": ["Fix code review comments", "Push the branch with grape git push"],
"conclusion": "Fixed according to the review comments; tests pass; ready for QA re-review",
"artifacts": ["PR #N comment", "commit abcdefg"],
"next_step": "a2a_issue",
"issue_summary": "Fixed review comments | Ready for re-review"
}
Successful response
{"ok":true,"task_id":"t_xxx","status":"completed","enriched":"attached"}
If the stream has not ended, status may be the current execution state and include pending_finalize: true; wait for the engine stream to end before converging to the final state.
External executor reporting
When a user-level identity does not include task_id but provides issue_number + node + repository, the server writes the conclusion as an event for that node with source=external and does not change the execution instance status. Repeated reports for the same (issue, node, session) return the existing seq with already=true.
GET /api/tasks/current
The Agent queries its current execution instance. No parameters are required.
Authentication: tk_ only.
Response structure
{
"task": {
"id": "t_xxx",
"status": "running",
"agent_type": "coding",
"skill": "<skill-name>",
"event_seq": 123,
"repo_key": "<owner>/<repo>",
"issue": {"id": 5, "issue_number": 1, "title": "<title>", "status": "active"},
"events_count": 3
}
}
The response does not include prompt. Agents can read the prompt directly in the Worker workspace; no additional API call is required.
Migrated or removed
POST /api/tasks/awaiting-inputhas moved to/api/issues/{issue_id}/awaiting-input; the old path returns410 Gone.- The original
/api/tasks/{task_id}/*user operation endpoints have moved to Issues. POST /api/tasks/closeand the attachment pre-upload endpoint have been removed; attachments are handled through Issues.
Related
Issues API | A2A collaboration API | Authentication and credentials | Error code dictionary