---
schema_version: "1"
id: 72476bb2400b414809d764c298c6e11cc8c15b7d9f7ec6425cd8556eced1bb63
title: agent trace delete
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfclireference/guides/agent/cli_reference_agent_trace_delete.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_agent_trace_delete.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 38a2fcdb45f2089cdf2f506e1cfd15fe168d99222f1ac8788c2d5b8779a0b297
products:
  - Salesforce CLI Command Reference
  - salesforcedx
---
<!-- prettier-ignore-start -->

# agent trace delete

Delete trace files from an agent preview session.

## Description for agent trace delete

When you run an agent preview conversation (either interactive or programmatic), trace files are automatically recorded and saved in your local DX project. Use this command to delete some or all of the trace files.

By default, this command shows a preview of what will be deleted and prompts for confirmation. Use --no-prompt to skip confirmation.

Without filters, this comamnd deletes all trace files for all agents and sessions. Use flags to narrow the scope: filter by agent API name (--agent), by session (--session-id), or by age (--older-than).

## Flags

| Flag Name (Long) | Flag Name (Short) | Description |
|------------------|-------------------|-------------|
| <code>&#8209;&#8209;agent</code> | <code>&#8209;a</code> | **Type:** Value<br><br>API name of the agent used to filter the list of trace files you want to delete. Matches against the API name used when starting the session, either an authoring bundle or a published agent API name. |
| <code>&#8209;&#8209;flags&#8209;dir</code> | N/A | **Type:** Value<br><br>Import flag values from a directory. |
| <code>&#8209;&#8209;json</code> | N/A | **Type:** Boolean<br><br>Format output as json. |
| <code>&#8209;&#8209;no&#8209;prompt</code> | N/A | **Type:** Boolean<br><br>Skip the confirmation prompt and delete immediately. |
| <code>&#8209;&#8209;older&#8209;than</code> | N/A | **Type:** Value<br><br>Duration used to filter the list of trace files; only files older than the duration are deleted. Accepts a number followed by a unit: m/minutes, h/hours, d/days, w/weeks. Examples: 7d, 24h, 2w. |
| <code>&#8209;&#8209;session&#8209;id</code> | N/A | **Type:** Value<br><br>Session ID used to filter the list of trace files you want to delete. Use the "agent preview sessions" CLI command to list all known agent preview sessions along with their session IDs. |

## Examples for agent trace delete

Delete all traces for all agents and sessions; prompt for confirmation:

```shell
sf agent trace delete
```

Delete all traces for a specific agent:

```shell
sf agent trace delete --agent My_Agent
```

Delete traces from a specific session:

```shell
sf agent trace delete --session-id <SESSION_ID>
```

Delete traces older than 7 days:

```shell
sf agent trace delete --older-than 7d
```

Delete traces older than 24 hours for a specific agent; don't prompt for confirmation:

```shell
sf agent trace delete --agent My_Agent --older-than 24h --no-prompt
```

Delete all traces for all agents and sessions; don't prompt for confirmation:

```shell
sf agent trace delete --no-prompt
```
<!-- prettier-ignore-end -->
