Agents - Durable event tasks

Free Agent Wake API Endpoint

Create one task that waits for a webhook, a person or a time. Read the same task later and continue from the event result. The REST API and MCP Tasks extension share the model.

  • No API key
  • 60s to 24h
  • REST and MCP
  • No task listing

Create and check

POST/agent_wake

GET/agent_wake/{task_id}

https://aisenseapi.com/services/v1

Wait for a webhook

curl -X POST https://aisenseapi.com/services/v1/agent_wake \
  -H "Content-Type: application/json" \
  -d '{"event_type":"webhook","timeout_seconds":3600}'
{
  "resultType": "task",
  "taskId": "2eb1a08d-759f-4af9-8caa-8b02b7ca17ba",
  "status": "working",
  "ttlMs": 3600000,
  "pollIntervalMs": 2000,
  "_meta": {
    "com.aisenseapi/agentWake": {
      "statusUrl": "https://aisenseapi.com/services/v1/agent_wake/2eb1a08d-...",
      "wakeUrl": "https://aisenseapi.com/services/v1/agent_wake/2eb1a08d-.../wake",
      "expiresAt": "2026-09-01T13:00:00Z"
    }
  }
}

Send the wakeUrl to the system that produces the event. Its first POST, PUT or PATCH completes the task. The next GET on statusUrl returns the captured body inside result.

Three event types

event_typeFieldsCompletion
webhooktimeout_secondsThe first request to wakeUrl
humantitle, description, options, allow_noteA person submits the hosted form
timedelay_seconds or wake_atThe first status read after the chosen time

timeout_seconds accepts an integer from 60 to 86400. Human events default to Approve and Reject when no options are supplied. Time events need one timing field.

Wait for a person

curl -X POST https://aisenseapi.com/services/v1/agent_wake \
  -H "Content-Type: application/json" \
  -d '{
    "event_type": "human",
    "title": "Release build 42?",
    "description": "The checks passed.",
    "options": ["Release", "Hold"],
    "allow_note": true,
    "timeout_seconds": 3600
  }'

The first status read reports status: "input_required". Its metadata contains formUrl. Send that link to the selected person. The submitted choice and note appear in the completed result.

The link identifies the task. It does not verify the person's identity. Use your own authenticated approval system for decisions that require a named or legally verified approver.

Wait until a time

{ "event_type": "time", "delay_seconds": 600, "timeout_seconds": 900 }

You can send wake_at as a Unix timestamp instead. The wake time must be after creation and before expiry. No worker or open connection is needed. The task completes when it is read after the chosen time.

Task states

The status is working, input_required, completed, failed or cancelled. A completed task contains the final MCP tool result. An expired task becomes failed. Cancel a waiting task with:

curl -X DELETE https://aisenseapi.com/services/v1/agent_wake/{task_id}

The task ID is a random bearer token. There is no endpoint that lists tasks.

MCP Tasks support

The create_agent_wake tool uses MCP revision 2026-07-28 and the io.modelcontextprotocol/tasks extension. A successful call returns resultType: "task". The client polls tasks/get and can call tasks/update or tasks/cancel.

Task requests repeat the extension capability on every call. The MCP-Name header carries the task ID. The server has no tasks/list or tasks/result method.

Read the complete MCP example.

Data and limits

Anyone with a task URL can read the result. Keep passwords, access tokens, personal data and confidential payloads out of it.

Webhook bodies are limited to 256 KB. Authorization, Cookie, X-API-Key and common token or secret headers are stored as [redacted]. Secrets inside the body cannot be detected safely and remain the caller's responsibility.

The first webhook wins. A later request returns HTTP 409 and cannot overwrite the result. Tasks are removed by the hourly cleanup after 24 hours.

The service shares the public limit of 5000 REST and MCP requests per IP per 24 hours. Respect the returned pollIntervalMs.

Useful flows

CI callback

Pause after starting a build. Resume when the build system sends its result.

Remote approval

Send a short form to a customer or colleague and continue after their answer.

Timed follow-up

Create a wake time and let the agent return after the deadline.

External job

Keep one task ID while a service finishes work outside the current process.