Skip to main content
Turn runs one turn of a published agent and hands the full transcript back to you. Unlike invoke, which starts fresh and returns only the reply, turn is built for callers that keep conversation state themselves and replay it on each request.

When to use which

The console’s own conversation chat uses this route under the hood. For most integrations, invoke is enough; reach for turn when you need to inspect or persist the transcript between turns.

Request

  • Header: Authorization: Bearer $GRADIENT_API_KEY. The key needs the agents:invoke scope.
  • Header: content-type: application/json.
  • Body: a JSON object.
Each entry in messages has this shape:

Example

Response

When the graph is parked on a timed wait, the response also carries waiting: true, a waitUntil timestamp, and any waitConfig.

Continuing a conversation

To take the next turn, send a request with the messages, currentNodeKey, and nodeVersion from the previous response, plus the new message. Keep the same agentId and nodeVersion for the life of the conversation.

Errors