Continue a conversation through the API
Send the conversation id back with your next message so the agent keeps the history and context of the earlier turns.
The examples use the ELOWEN_URL and ELOWEN_TOKEN variables set up in Send your first agent API request.
Continue a conversation
Every run names the conversation it used. Pass that value as conversationId to continue it:
curl -sS "$ELOWEN_URL/api/v1/agent/runs" \
-H "Authorization: Bearer $ELOWEN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"message":"Open an issue for the second one","conversationId":"brain-12-…"}'
Without conversationId, every run starts a new conversation and the agent starts from nothing.
The first answer of a new conversation is the only place its id appears in a plain run, so store it with whatever your script is working on. A streaming run names it in the first start event.
Which conversations you can continue
- You can continue any of your own conversations, including ones you started in the web app or the CLI.
- Another account's conversation, or an id that does not exist, answers
404 {"error":"unknown conversation"}. - Conversations a script creates appear in your conversation history like any other, so you can read or continue them in the web app.
- A run through the API never changes which conversation your web app or CLI opens next.
If the conversation is busy
One conversation runs one turn at a time. A run into a conversation that is already working answers 409 {"error":"conversation_busy"} and counts nothing against your token.
Waiting is the fix: send the message again once the other turn finishes, or start a new conversation for work that does not depend on the old history. The other turn can be a run of yours or a message you typed in the web app.
Related guides
See Send your first agent API request for the run request itself, and Agent API errors for every status code the API returns.