Skip to main content
Running a conversation over the API takes two calls: launch the agent, then send what the user said. A conversation is identified by the userID in the path, so there is no session to create and nothing to thread between calls.

The recipe

main.sh

How it works

  • The userID in the path IS the conversation. Call the same path again and the agent picks up where it left off; call it with a new userID and you get a fresh conversation.
  • action is what the user did. launch starts the agent from its entry point, text sends something they typed. The full set is in the trace reference.
  • version chooses which build answers: published runs the live version of the environment, draft runs what you are currently editing.
  • The response is an array of traces describing what the agent did. text carries the words a chat agent said; a voice agent answers with speak instead.
  • environmentAlias names the environment to run. New projects start with main.

When it fails