> Source: https://wexa.ai/docs/agents/restart-execution

# restart-execution

[Can be held for approval](/docs/sdks-and-apis/how-every-tool-call-works#lifecycle-and-governance)

Re-run an execution, the same as Restart in the console, instead of starting over with [run-process-flow](/docs/automation/run-process-flow). A restart is a new execution. Needs the `fabric:agent.run` grant.

The shape of `result` for `restart-execution` is not recorded here: it was not captured against a live deployment. Call it once and read what comes back rather than assuming a shape.

**Restart a run from one agent**

**Wexa MCP server**

```bash
curl -sS -X POST https://fabric.wexa.ai/mcp/$FABRIC_PROJECT_ID \
  -H "authorization: Bearer $FABRIC_API_KEY" \
  -H "Mcp-Session-Id: $MCP_SESSION_ID" \
  -H "content-type: application/json" -H "accept: application/json" \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"restart-execution","arguments":{"execution_id":"d8b83fa9-afa7-4619-886f-55fafe5c9bc6","agent_id":"6ab1945e7566f41b5c28e30a"}}}'
```

**REST API**

```bash
curl -sS https://fabric.wexa.ai/v1/restart-execution \
  -H "authorization: Bearer $FABRIC_API_KEY" \
  -H "content-type: application/json" \
  -d '{"execution_id":"d8b83fa9-afa7-4619-886f-55fafe5c9bc6","agent_id":"6ab1945e7566f41b5c28e30a"}'
```

**TypeScript SDK**

```ts
import { Fabric } from '@wexa-fabric/sdk'

const fabric = new Fabric()
const result = await fabric.restartExecution({
  execution_id: 'd8b83fa9-afa7-4619-886f-55fafe5c9bc6',
  agent_id: '6ab1945e7566f41b5c28e30a'
})
```

**Python SDK**

```python
from wexa import Fabric

fabric = Fabric()
out = fabric.restart_execution(
    execution_id="d8b83fa9-afa7-4619-886f-55fafe5c9bc6",
    agent_id="6ab1945e7566f41b5c28e30a",
)
```

## Parameters

| Parameter | Type | Required | Notes |
| --- | --- | --- | --- |
| `execution_id` | string | Required | The execution, from `run-process-flow` or `list-executions`. An execution in this project. It must be `paused`, `failed`, `completed` or `anomaly_detected`; any other state is refused (409), for example `execution … is running; it can be restarted only when it is paused, failed, completed, anomaly_detected`. |
| `agent_id` | string | Optional | The agent to restart from, an agent `_id` of the run's process flow. Omit it to restart from the first agent. Must be a string; one that is not an agent of the run's process flow is refused (404) and the message lists the run's agents. |

**Errors**

- `ConflictError` (409): the execution has no agent to restart from.

**More details**

Poll the `execution_id` the call returns with [get-execution](/docs/agents/get-execution); `restarted_from` is the run it came from. The original run is left as it was and a new execution is created, so `execution_id` is the new run and `restarted_from` the original. `status` is `ready` when it has just been queued, and `agent_id` is the agent the new execution starts from: the one you passed, or the run's first agent.

With `agent_id` it restarts from that agent of the run, keeping the work of the agents before it; from that agent on, every agent runs again. `agent_id` is checked against the run's own snapshot of the process flow, the one it ran with, not the process flow as it is now. An agent that is not in that snapshot is refused with a `404` that lists the run's agents. Restarting an `anomaly_detected` run cancels the original run and starts the new one. A run in any other state, such as one still `running`, is refused with a `409` and nothing changes. A run in another project, or one started by someone else, reads as not found, exactly as it does for `get-execution`.

### Result fields

- `execution_id`: The new execution. Poll it with `get-execution`.
- `status`: The new execution's status, `ready` when it has just been queued.
- `restarted_from`: The execution you restarted.
- `agent_id`: The agent the new execution starts from: the one you passed, or the run's first agent.

Every tool call works the same way: [How every tool call works](/docs/sdks-and-apis/how-every-tool-call-works).
