---
title: "An agent run completed (success or failure)"
method: POST
path: "agent.finished"
tags: ["Webhooks"]
---

# An agent run completed (success or failure)

`POST agent.finished` (webhook)

Fires when an agent run terminates — whether it completed
normally, hit max iterations, was cancelled, or errored. Check
`data.success` to discriminate.

## Payload

- object: Common envelope every webhook delivery uses. `data` is the per-event payload — branch on `type` to know its shape. Signature header: `X-JE-Signature: t=<unix>,v1=<hex>` computed as HMAC-SHA256 over `t + "." + raw_body`. Reject deliveries whose `t` is more than 5 minutes from your server clock.
  - `api_version` string
  - `created` integer, required: Unix seconds.
  - `data` object, required: Event-specific payload (see schemas below).
    - `cost_usd` number, double
    - `duration_ms` integer
    - `job_id` string, uuid
    - `session_id` string
    - `steps` integer
    - `success` boolean
  - `id` string, uuid, required
  - `type` 'agent.finished', required

## Acknowledgement `200`

Acknowledged.

---

[API](https://skmtc.dev/johnsessentials/apis/john-s-essentials-api.md) · [All operations](https://skmtc.dev/johnsessentials/apis/john-s-essentials-api/llms.txt) · [OpenAPI document](https://skmtc.dev/johnsessentials/apis/john-s-essentials-api/revisions/56586ff78e6d?raw)
