Skip to main content
Invoke runs a published agent version against a single message and returns the agent’s reply. It is the simplest way to call an agent from your own code.
The call is stateless and starts from an empty transcript. The engine drives the graph, following any agent_swap handoffs and resolving tool calls, until the turn settles, then returns the final assistant text. For a multi-turn conversation where you keep and replay the transcript yourself, use Turn instead.

Path parameters

Request

  • Header: Authorization: Bearer $GRADIENT_API_KEY. The key needs the agents:invoke scope. See Authentication.
  • Header: content-type: text/plain.
  • Body: the user’s message as plain UTF-8 text, up to 1 MB. It must not be empty.

Response

On success the engine returns 200 with a single field:

Errors

Every invoke is recorded as a production trace, so calls made this way show up alongside chat and voice conversations in the console.