Skip to content

Inspect and run a Chain ​

A Chain describes executable work. This guide covers the documented operations for inspecting its task graph and requesting a manual run.

Before you run it ​

Use the ID of a Chain you are allowed to access. You need an interactive access token and the applicable workspace role, execution authority, and usage coverage. Start with Chain creation if you do not have a Chain yet.

Executing work may consume AI usage or invoke authorized external tools. Review the instructions and permissions before requesting a run.

Documented endpoints ​

MethodPathResult
GET/chains/:id/bit-treeThe Chain's task graph
POST/chains/:id/trigger-runAn admitted execution request

Inspect the task graph ​

curl --fail-with-body -sS "https://api.chainabit.com/api/v1/chains/$CHAIN_ID/bit-tree" \
  -H "Authorization: Bearer $TOKEN" | jq .

The result describes the graph's tasks and relationships. An instruction-backed Chain can execute directly; do not assume an empty task graph means it has no instructions.

Trigger a workflow run ​

export REQUEST_KEY="$(uuidgen)"
curl --fail-with-body -sS -X POST "https://api.chainabit.com/api/v1/chains/$CHAIN_ID/trigger-run" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Idempotency-Key: $REQUEST_KEY" | jq .

The endpoint returns a data object with runId and status. Save the returned ID. Reuse the same idempotency key only when retrying the same execution request.

The response acknowledges execution admission. It does not prove that tools ran successfully or that the requested outcome was achieved. Follow the run in the product and inspect its final result.

Execution settings ​

Earlier versions of this page described direct policy-editing requests. Those examples are no longer maintained here. Use the product's supported workflow controls to manage execution settings, and the documented operations above when building an integration.

Task source and permissions ​

A task-based workflow needs valid execution sources and authorized agents. Capturing instructions or attaching an agent does not grant access to unrelated resources. If an agent or its permissions changes before execution, the run can be refused and must be reviewed again.

When a run is refused ​

Check the response code and message before retrying. Typical causes include unavailable or changed execution sources, an inaccessible Chain, missing execution authority, and invalid instructions. See Chain admission guidance and error codes.

Tools not granted ​

When the Chain's instructions need tools and its access settings grant none, the request is refused before anything starts:

json
{
  "error": {
    "code": "chain_authorization_required",
    "message": "This Chain's instructions need tools, and its access settings grant none yet. Nothing ran.",
    "details": {
      "failure": {
        "category": "unsupported_action",
        "reason": "chain_authorization_required",
        "retry": "after_state_change",
        "repairable": false,
        "requiredAction": "authorize",
        "sideEffect": "not_attempted",
        "affectedFields": ["grant"]
      }
    }
  }
}

The status is 422. Nothing ran and nothing needs to be undone. Retrying the same request returns the same refusal. Ask a person who can manage the Chain's access settings to grant at least one tool there, then request the run again.

Built with purpose. chainabit.com