---
question: Which callers do I edit before deleting a workflow?
kind: task
via_web: na
via_cli: available
via_python: available
via_api: na
via_config: na
ref_cli: git rm
ref_python: Workflow
prereq: The workflow is a `<Name>Workflow.py` file in the `workflows/` folder of an in-engine module of your project.
next:
  - /capabilities/build/workflows/overview
  - /capabilities/build/agents/creating-a-workflow
  - /capabilities/build/agents/give-it-tools
---

# Delete a workflow

A workflow exists because its class sits in the module's `workflows/` folder. Delete the class and what refers to it, then restart the engine: the class, its tools and its `POST /workflows/...` route are gone.

## Web UI

Not applicable. Nexus has no screen for workflows: a workflow is a Python class in a module. Use the CLI or Python steps on this page.

## CLI

### Find what uses it

From the project root:

```bash
grep -rn "CustomersWorkflow" src/
```

Agents that add its tools in `New()`, other workflows that compose it, and module jobs that call it all import the class.

### Edit the callers

Change each file the search found before deleting the class, as in the [Python steps](/user-guide/build/workflows/delete-a-workflow?via=python). An agent whose `New()` still imports the workflow raises `ModuleNotFoundError` when the API builds it at startup.

### Remove the files

```bash
git rm src/my_module/workflows/CustomersWorkflow.py
```

`abi new workflow` writes no test file. If you wrote `CustomersWorkflow_test.py`, remove it too:

```bash
git rm src/my_module/workflows/CustomersWorkflow_test.py
```

### Restart the engine

The engine discovers workflows when it starts:

```bash
abi dev down
abi dev up
```

With Docker Compose, run `abi stack stop`, then `abi stack start`. The commands are [`abi dev`](/user-guide/reference/cli#abi-dev) and [`abi stack`](/user-guide/reference/cli#abi-stack).

### Check it is gone

`POST /workflows/customers_workflow` now answers 404, and the Workflows group of `/docs` no longer lists it. When no workflow is left, the API leaves the Workflows group out.

## Python

### Remove its tools from the agents

Drop the import and the `as_tools()` call from each agent's `New()`:

```python title="agents/CustomersAgent.py"
@classmethod
def New(
    cls,
    agent_shared_state: Optional[AgentSharedState] = None,
    agent_configuration: Optional[AgentConfiguration] = None,
) -> "CustomersAgent":
    ...
    tools: list = []
    # Removed:
    # from my_module.workflows.CustomersWorkflow import (
    #     CustomersWorkflow, CustomersWorkflowConfiguration,
    # )
    # tools += CustomersWorkflow(CustomersWorkflowConfiguration()).as_tools()
```

The scaffolded `New()` fills the `[TOOLS]` block of the system prompt from that list, so the prompt follows. If you wrote the tool into the prompt by hand, remove it there too.

Do this before deleting the class: an agent whose `New()` still imports the deleted module raises `ModuleNotFoundError` when the API builds it at startup.

### Remove the other callers

Workflows that build it in `__init__` and `@job` handlers that run it need another source for that result, or go too.

### Delete the class

Delete `workflows/CustomersWorkflow.py`, and `CustomersWorkflow_test.py` if you wrote one, then restart the engine as in the [CLI steps](/user-guide/build/workflows/delete-a-workflow?via=cli).

## REST API

Not applicable. No endpoint deletes a workflow: the API publishes the classes the engine loaded. Once the class is gone and the engine restarted, `POST /workflows/<name>` answers 404.

## Config

Not applicable. `config.yaml` has no switch for one workflow. `enabled: false` on the module's entry turns off the whole module, with all its agents and workflows.
