Skip to content

Tasks API

Tasks are the primary unit of work in Kernel Service. Submit an objective, and the orchestrator processes it through an AI agent.

Create Task

POST /api/v1/tasks

Request Body

FieldTypeRequiredDescription
objectivestringYesWhat the agent should accomplish
agent_idUUIDNoAgent to execute on behalf of
pack_idUUIDNoAgent pack to use
subject_refsarrayNoEntities the task relates to
constraintsobjectNoConstraints on execution
priorityintegerNo1-10, default 5

Example

Terminal window
curl -X POST https://api.kernelservice.com/api/v1/tasks \
-H "Content-Type: application/json" \
-H "X-Tenant-ID: $TENANT_ID" \
-H "X-API-Key: $API_KEY" \
-d '{
"objective": "Qualify lead #456 and draft a follow-up email",
"agent_id": "agent-uuid",
"subject_refs": [
{"type": "lead", "id": "456", "product": "ROL"}
]
}'

Response

{
"task_id": "uuid",
"run_id": "uuid",
"status": "completed",
"output": {"response": "..."},
"metrics": {
"total_input_tokens": 2507,
"total_output_tokens": 693,
"total_cost_cents": 0.05,
"model_used": "gemini-2.0-flash",
"elapsed_ms": 6709,
"step_count": 5
},
"steps": [...]
}

Get Task

GET /api/v1/tasks/{task_id}

Returns the full task result including audit trail.

List Tasks

GET /api/v1/tasks?status=completed&limit=20
ParameterTypeDescription
statusstringFilter by status
limitintegerResults per page (max 100)
offsetintegerPagination offset

Cancel Task

POST /api/v1/tasks/{task_id}/cancel