Start an agent turn

Start an agent turn

Starts a new agent turn. With delivery: after_turn and a stable UUID clientTurnId, the turn starts now when the chat is idle and its queue empty, and otherwise joins the durable FIFO queue; a retry with the same id returns the same receipt. An immediate turn can include editFrom: {messageId, tipId} to replace a prompt and remove later transcript rows atomically with admission, restoring the workflow checkpoint those rows made. The draft endpoint supplies the current tip. Callers omitting delivery get 409 while the chat is busy or has queued messages. Queued replies include {queued:true,queueId,sessionId,state}; started turns include the durable handle {runId, sessionId, jobId}. The turn runs detached; stream its events over the session WebSocket or poll the session. agentMode is required. The SDK's sessions.dispatch.

POST/api/agent/runs
Body
sessionIdstringrequired
promptstring
clientTurnIdstring
editFromobject

messageIdstringrequired
tipIdstringrequired
resumeboolean
deliveryenum

One of: after_turn

modelIdstring
workflowIdstring
workflowRunIdobject
workflowNamestring
versionIdstring
checkpointVersionIdstring
vaultIdstring
spaceIdstring
workflowDataobject
workflowDataHashstring
lastRunIdstring
workflowHasScheduleboolean
lastRunStatusobject

runIdstringrequired
statusstringrequired
completedAtstring
workbenchObservationobject

schemaVersionenumrequired

One of: 1

surfaceIdstringrequired
generationstringrequired
revisionintegerrequired
sessionIdstringrequired
observedAtstringrequired
workspaceVisiblebooleanrequired
activeTabIdstringrequired
tabsobject[]required

tabIdstringrequired
kindstringrequired
titlestringrequired
viewenumrequired

One of: workflow, database, files, app, desktop, device, resource, new, unknown

targetobject

workflowIdobject
agentSessionIdobject
computerIdobject
pageIdstring
browserTargetobject

sessionIdstringrequired
targetIdstringrequired
revisionintegerrequired
sandboxSessionIdstringrequired
nativeIdstringrequired
vaultIdobject
sandboxIdobject
versionIdobject
runIdobject
subjobIdobject
moduleIdobject
nodeNameobject
hierarchyobject
tableIdobject
queryIdobject
resourceIdobject
libraryItemTypeenum

One of: tool, script, module, workflow, solution

conversationViewenum

One of: list

desktopDeviceenum

One of: android

scopeobject
filePathstring
fileViewenum

One of: preview, source, split

requestedUrlobject
urlobject
appIdobject
renderedUrlobject
displayedUrlobject
deployedUrlobject
omittedTabCountintegerrequired
editorModeenum

One of: workflow, app, agent, database

moduleContextobject

isModuleWorkflowbooleanrequired
moduleWorkflowIdstring
parentWorkflowIdstring
parentWorkflowNamestring
returnToNodestring
agentModeenumrequired

One of: agent, plan

focusedNodestring
focusedNodeContextobject
mentionedNodesstring[]
timezonestring
appContextstring
sandboxSessionIdstring
sandboxPreviewUrlstring
sandboxDatasetsobject[]

tableIdstringrequired
tableNamestringrequired
columnsobject[]required

namestringrequired
typestringrequired
imageAttachmentsobject[]

typeenumrequired

One of: image

datastringrequired
mimeTypestringrequired
namestringrequired
sizenumberrequired
fileAttachmentsobject[]

typeenumrequired

One of: file

idstringrequired
namestringrequired
sizenumberrequired
annotationsobject
interactiveenum

One of: true

Request

curl
curl -X POST https://trickest.io/api/agent/runs \
  -H "Authorization: Token $TRICKEST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ }'

Responses

202Turn accepted
400Bad Request – validation error or malformed input
codestringrequired
messagestringrequired
detailsobject

Field-level detail when the error is a validation failure.

401Unauthorized – missing or expired token
codestringrequired
messagestringrequired
detailsobject

Field-level detail when the error is a validation failure.

403Forbidden – insufficient permissions
codestringrequired
messagestringrequired
detailsobject

Field-level detail when the error is a validation failure.

429Too Many Requests – rate limited
codestringrequired
messagestringrequired
detailsobject

Field-level detail when the error is a validation failure.

500Internal Server Error
codestringrequired
messagestringrequired
detailsobject

Field-level detail when the error is a validation failure.