OpenCode Reply
opencode-replyContinue an existing OpenCode session by sending a new prompt with its session ID, then block until the turn completes and return the answer.
Instructions
Use this to continue an existing OpenCode session started with opencode, after reading its previous result from structuredContent.content. Requires exactly one of sessionId, threadId or conversationId, plus a new prompt. Blocks until the turn finishes (or wait-seconds elapses, up to the turn timeout); the answer is in structuredContent.content. sandbox and approval-policy stay fixed for the life of the session. Cancelling or stopping the call that OWNS this turn (Esc, TaskStop, a client timeout) cancels the OpenCode turn; a call that only joined an existing turn as an observer (e.g. a duplicate request-id) detaches without cancelling anything. To stop waiting but keep the turn running, pass wait-seconds and poll opencode-status. Same detail/max-output-chars/request-id/output-schema options as opencode; output-schema applies only to this turn, never a stored default.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent | No | OpenCode's primary agent for this session (e.g. 'build', 'plan', or a custom agent). Omit to use the server-configured default, or OpenCode's own default agent. Given here, it replaces the stored value for this and later turns. | |
| model | No | Model to use, in the form 'provider/model' (e.g. 'my-gateway/coder-large'), not a bare model name. Omit to use the server-configured default, or OpenCode's own resolution if none is set. Given here, it replaces the stored value for this and later turns. | |
| detail | No | 'compact' (default 'standard') drops toolCalls and filesChanged from this response (keeping toolCallCount, filesChangedCount, pendingApprovalCount, and pendingApprovals itself) to save context; the full answer and tool-call log stay retrievable with opencode-output regardless of this setting. | |
| prompt | Yes | The next message to send to OpenCode in this session. | |
| threadId | No | Alias for sessionId (Codex-compatible name), same session id value. Exactly one of sessionId, threadId, conversationId is required to target a session; opencode-status may omit all three to list tracked sessions instead. | |
| sessionId | No | Id of a session tracked by this server, from a prior opencode call. Exactly one of sessionId, threadId, conversationId is required to target a session; opencode-status may omit all three to list tracked sessions instead. | |
| request-id | No | Idempotency key for this exact call (pattern: starts with a letter/digit, then up to 127 more letters/digits/'.'/'_'/':'/'-'). Retrying the same request-id after a network drop or client retry joins the original operation instead of sending a second prompt to OpenCode; a different request-id (or omitting it) always starts a new one. Shared between opencode and opencode-reply. | |
| wait-seconds | No | Bounds only how long THIS call waits for a result, in seconds; it does not limit the turn itself. On expiry this call returns a 'running' (or 'waiting_for_approval') snapshot while the turn keeps executing on the server — continue observing it with opencode-status. Omit to block until the turn reaches a terminal state (subject to timeout-seconds); 0 returns immediately after admission — combine with opencode-status ids/wait-for to fan a batch of turns out in parallel and then observe them together. | |
| output-schema | No | Ask OpenCode's final message for THIS turn to be one JSON value matching this JSON Schema (subset: object/array/string/number/integer/boolean/null; no $ref or unions; see README for the full list of supported keywords). Reported back as structuredOutput / structuredOutputStatus ('valid'/'missing'/'invalid'); still untrusted model output, and never changes status, error or retry behaviour. Turn-local: never inherited by a later reply. | |
| conversationId | No | Deprecated alias for sessionId, same session id value. Exactly one of sessionId, threadId, conversationId is required to target a session; opencode-status may omit all three to list tracked sessions instead. | |
| timeout-seconds | No | This turn's hard run-time limit, in seconds. When it expires, the OpenCode run is stopped and the result comes back with status 'timeout' — the work already done is not lost, but the turn itself ends. This is not a call timeout: to stop waiting for a response while letting the turn keep running, use wait-seconds instead. | |
| max-output-chars | No | Caps how many characters of the answer come back in THIS response only (0..44000; 0 returns no answer text at all). Never truncates the retained turn — read the rest with opencode-output. Omit to use the default for the chosen detail level (44000 standard, 2000 compact). | |
| developer-instructions | No | System-prompt text for this session. Omitted: the stored value (if any) is re-sent; given: replaces the stored value for this and later turns. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cost | No | ||
| diff | No | ||
| hint | No | ||
| kind | Yes | ||
| turn | No | ||
| agent | No | ||
| error | No | ||
| model | No | ||
| roots | No | ||
| total | No | ||
| action | No | ||
| agents | No | ||
| finish | No | ||
| models | No | ||
| offset | No | ||
| output | No | ||
| reason | No | ||
| server | No | ||
| status | Yes | ||
| tokens | No | ||
| turnId | No | ||
| cleanup | No | ||
| content | Yes | ||
| hasMore | No | ||
| partial | No | ||
| request | No | ||
| results | No | ||
| section | No | ||
| waitFor | No | ||
| readyIds | No | ||
| sessions | No | ||
| threadId | No | ||
| warnings | No | ||
| directory | No | ||
| elapsedMs | No | ||
| sessionId | No | ||
| toolCalls | No | ||
| truncated | No | ||
| nextOffset | No | ||
| observedAt | No | ||
| pendingIds | No | ||
| snapshotId | No | ||
| availability | No | ||
| filesChanged | No | ||
| resendSafety | No | ||
| responseLoop | No | ||
| upstreamRead | No | ||
| omittedFields | No | ||
| toolCallCount | No | ||
| upstreamRetry | No | ||
| executionState | No | ||
| opencodeVersion | No | ||
| pendingApprovals | No | ||
| structuredOutput | No | ||
| filesChangedCount | No | ||
| abortedRunningTurn | No | ||
| pendingApprovalCount | No | ||
| structuredOutputError | No | ||
| structuredOutputStatus | No |