> For the complete documentation index, see [llms.txt](https://docs.uptiq.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uptiq.ai/cookbooks/platform-admin/agents-and-evidence/stop-an-agent.md).

# Stop an agent

Interrupt one execution, one agent, one project, or the whole account.

`POST /agents/executions/abort` stops active work, scoped by whichever combination of `agentId`, `projectId`, and `allProjects` you send. This is the API equivalent of [Stop an agent](https://docs.uptiq.ai/platform-guides/admin/agents-and-evidence/stop-an-agent).

## At a glance

| Item              | Value                                            |
| ----------------- | ------------------------------------------------ |
| ⚙️ Microservice   | `Agent Builder`                                  |
| 🌍 Environment    | `QA`                                             |
| 🔗 Base URL       | `https://api-builder-qa.uptiq.dev/agent-builder` |
| ⌘ Endpoint        | `POST /agents/executions/abort`                  |
| 🔐 Authentication | User session token                               |

{% columns %}
{% column %}

#### What it does

Queues an abort for active work in the selected scope.
{% endcolumn %}

{% column %}

#### Success looks like

The service returns `202 Accepted` while it processes the abort.
{% endcolumn %}
{% endcolumns %}

| Scope          | Control Center                         | API                       |
| -------------- | -------------------------------------- | ------------------------- |
| One project    | Stop work in the selected project.     | Send `projectId`.         |
| Entire account | Switch projects and repeat the action. | Send `allProjects: true`. |

Stopping interrupts current runs only. It doesn't disable the agent. The agent runs again at its next trigger.

## Before you start

Your API key needs the **Stop agents** capability (`StopAgents`). Know the scope you actually want — this call's safety model is opt-in widening, not opt-in narrowing. See Developer notes.

### Authentication

| Use                 | Send                            | Don't send       |
| ------------------- | ------------------------------- | ---------------- |
| Agent Builder calls | `authorization: Bearer <token>` | `x-platform-key` |

Agent Builder doesn't accept an account API key. QA returned the same `404 ACCOUNT_NOT_FOUND` with an account key and no credential. The session token expires one hour after issue. This recipe can't run unattended today. See [Authentication](https://gitlab.com/uptiq-inc-enterprise/development/documentation/platform-docs-repo/-/tree/main/api-references/qa/getting-started/authentication.md).

## Request

`POST /agents/executions/abort`

| Field         | Type    | Required | What it does                                                                   |
| ------------- | ------- | -------- | ------------------------------------------------------------------------------ |
| `agentId`     | string  | No       | Limit the abort to this agent. Omit to abort every running execution in scope. |
| `projectId`   | string  | No       | Limit the abort to this project.                                               |
| `allProjects` | boolean | No       | Abort across every project in the account.                                     |

## Code snippets

{% tabs %}
{% tab title="cURL — one agent" %}

```bash
curl -X POST https://api-builder-qa.uptiq.dev/agent-builder/agents/executions/abort \
  -H "authorization: Bearer YOUR_SESSION_TOKEN" \
  -H "content-type: application/json" \
  -d '{ "agentId": "agent_123", "projectId": "proj_456" }'
```

{% endtab %}

{% tab title="cURL — whole project" %}

```bash
curl -X POST https://api-builder-qa.uptiq.dev/agent-builder/agents/executions/abort \
  -H "authorization: Bearer YOUR_SESSION_TOKEN" \
  -H "content-type: application/json" \
  -d '{ "projectId": "proj_456" }'
```

{% endtab %}

{% tab title="cURL — whole account" %}

```bash
curl -X POST https://api-builder-qa.uptiq.dev/agent-builder/agents/executions/abort \
  -H "authorization: Bearer YOUR_SESSION_TOKEN" \
  -H "content-type: application/json" \
  -d '{ "allProjects": true }'
```

{% endtab %}
{% endtabs %}

```javascript
// JavaScript, any scope — vary the body per the tabs above
await fetch("https://api-builder-qa.uptiq.dev/agent-builder/agents/executions/abort", {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.UPTIQ_SESSION_TOKEN}`,
    "content-type": "application/json",
  },
  body: JSON.stringify({ agentId: "agent_123", projectId: "proj_456" }),
});
```

```python
# Python, any scope — vary the body per the tabs above
import os, requests

requests.post(
    "https://api-builder-qa.uptiq.dev/agent-builder/agents/executions/abort",
    headers={
        "authorization": f"Bearer {os.environ['UPTIQ_SESSION_TOKEN']}",
    },
    json={"agentId": "agent_123", "projectId": "proj_456"},
)
```

## Response

| Result          | What it means                                                    | Next action                                                                                        |
| --------------- | ---------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `202 Accepted`  | The abort is queued. It doesn't confirm every execution stopped. | Poll `GET /agents/{agentId}/executions/{executionId}/queue-status` to confirm one execution ended. |
| No matching run | The request succeeds with no effect.                             | Treat this as a no-op.                                                                             |

## Developer notes

| Situation          | What to do                                                                                                                  |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------- |
| Stop every project | Set `allProjects: true`. Omitting `projectId` doesn't widen the abort.                                                      |
| Stop one execution | Use Agent Executor's `POST /agents/{agentId}/executions/{executionId}/abort`. It doesn't need `projectId` or `allProjects`. |

## Related

* [Stop an agent](https://docs.uptiq.ai/platform-guides/admin/agents-and-evidence/stop-an-agent) — as a screen
* [Investigate an agent run](/cookbooks/platform-admin/agents-and-evidence/investigate-a-run.md)
* [Review connector access](/cookbooks/platform-admin/agents-and-evidence/review-what-agents-can-reach.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.uptiq.ai/cookbooks/platform-admin/agents-and-evidence/stop-an-agent.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
