You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[QUESTION] How can I know if the session has ended from the server API? #3075
When I send a prompt to the opencode server via API, how should I know if opencode has completed this operation?
I tried GET /sessions, GET /sessions/{id}, GET /sessions/{id}/message, but from the return values, it seems none of them indicate whether the AI's response has ended.
Did I miss something, or should I use a different interface to know this?
This issue might be a duplicate of existing issues. Please check:
[question] API documentation #2168: Similar question about API documentation and expected flow for session endpoints, specifically asking about how to determine when AI response has ended and proper polling patterns
Feel free to ignore if none of these address your specific case.
@dayeguilaiye are you able to get the messageID of the response?
Also I feel like if you do get a response after sending the prompt, that is your indication that the operation is completed. Not sure you will get a response without OpenCode being done.
@OpeOginni@rekram1-node Thank you very much for your reply. I didn't realize that POST /session/{id}/message is a synchronous interface; I thought it was asynchronous. So as long as this interface doesn't return, it means the agent is still running.
Activity
github-actions commentedon Oct 10, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
OpeOginni commentedon Oct 10, 2025
@dayeguilaiye are you able to get the messageID of the response?
Also I feel like if you do get a response after sending the prompt, that is your indication that the operation is completed. Not sure you will get a response without OpenCode being done.
rekram1-node commentedon Oct 10, 2025
@dayeguilaiye if u send a request to /session/${sessionId}/message the request is finished after llm finishes... isn't that the best indicator here?
EX:
dayeguilaiye commentedon Oct 11, 2025
@OpeOginni @rekram1-node Thank you very much for your reply. I didn't realize that
POST /session/{id}/messageis a synchronous interface; I thought it was asynchronous. So as long as this interface doesn't return, it means the agent is still running.