Undo an agent turn
POST
/api/v1/ai/turns/{id}/undo
const url = 'https://example.com/api/v1/ai/turns/example/undo';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"keep_conflicts":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/ai/turns/example/undo \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "keep_conflicts": true }'Undo file changes from an agent turn. Set keep_conflicts to leave changed items as they are and undo other safe changes. The response lists any items it kept. Ask turns cannot be undone. Route: /api/v1/ai/turns/{id}/undo. Inputs: id. Do not automatically replay this operation after an uncertain result.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”id
required
string
Request Body
Section titled “Request Body”Responses
Section titled “Responses”The turn was undone; with keep_conflicts, conflicts lists the kept items
Media typeapplication/json
object
conflicts
required
Array<object>
object
path
required
string
reason
required
string
undone
required
boolean
Examplegenerated
{ "conflicts": [ { "path": "example", "reason": "example" } ], "undone": true}Media typeapplication/json
The standard API error response: { "error": { ... } }.
object
Example
{ "error": { "code": "bad_request" }}Media typeapplication/json
The standard API error response: { "error": { ... } }.
object
Example
{ "error": { "code": "bad_request" }}Media typeapplication/json
object
conflicts
required
Array<object>
object
path
required
string
reason
required
string
undone
required
boolean
Examplegenerated
{ "conflicts": [ { "path": "example", "reason": "example" } ], "undone": true}