Skip to content

[FEATURE]: v2 SDK: bind agent/model/variant options to queued prompts #48356

Open

Description

@remorses

Verification

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

I am porting Kimaki to v2. I need to queue a prompt with its own agent, model, and variant without changing the work already running.

Proposed SDK API:

await client.session.prompt({
  sessionID,
  text: "Review the changes",
  delivery: "queue",
  agent: "review",
  model: {
    providerID: "anthropic",
    modelID: "claude-opus-4-6",
    variant: "high",
  },
})

Store these options with the durable input and apply them when it is delivered, not when it is queued. Omitted options keep the existing behavior.

Today, separate session.switchAgent() / session.switchModel() calls change session-wide selection before the queued prompt runs. Attaching options to the input would let Kimaki use the OpenCode queue directly instead of keeping a separate client-side queue to coordinate selection.

This is a proposed API capability, not a reproduced concurrency bug.

Activity

  1. changed the title [-]v2 SDK: bind agent/model options to queued prompts[/-] [+][FEATURE]: v2 SDK: bind agent/model/variant options to queued prompts[/+] on Sep 10, 2026
  2. github-actions commented on Sep 10, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! It now meets our contributing guidelines — the feature request is clear, uses the correct template, includes the verification checkbox, and explains the use case well. We'll take a look.

  3. hir0xygen commented on Sep 23, 2026

    @hir0xygen

    +1, hitting the same thing in the V2 TUI. Reporting the client-side repro since this issue is framed as SDK-only:

    1. Start a turn in build (agent working).
    2. While it runs, switch agent to plan and queue the prompt with ctrl+x enter.
    3. The active agent switches to plan at the next steer opportunity, before the queued prompt is delivered, so the in-flight turn finishes under plan mode.

    Expected: session-wide selection stays put, and the queued prompt's agent is applied only when that prompt is actually delivered.
    Same "apply when delivered, not when queued" semantics requested here.

  4. yee94 commented on Oct 28, 2026

    @yee94

    Another concrete integration use case from Yuri, a multi-client UI for OpenCode: users switch models while a turn is running, then queue a follow-up expecting it to use the model selected when they submitted it. Currently we can retain that selection in metadata, but execution still uses the session-wide model, so the queued task can run with the previous model instead.

    Client-side coordination is not a viable substitute for us: users may close the app or go offline immediately after submitting. We need OpenCode's durable queue to own execution independently of the submitting client. Switching the session model at admission also does not provide per-item isolation and can affect work already running.

    The behavior proposed here is exactly what we need: persist agent/model/variant with each admitted input, apply them at the delivery boundary, and preserve existing behavior when those options are omitted. It should continue to work after the client disconnects and when multiple queued inputs select different models.

    This is a real user-facing limitation for us, not just SDK ergonomics. Is there a planned implementation or an upstream PR we can follow and help validate? Happy to provide the integration scenario and test the eventual API.

  5. opencodejr commented on Oct 28, 2026

    @opencodejr

    Thanks for the request, and for the clear use case from porting Kimaki.

    To restate it: you'd like session.prompt (especially with delivery: "queue") to accept optional agent and model (including variant). These would be stored with the queued input and applied when it is delivered, so a queued prompt can run with its own selection without changing the work already running. Today the prompt input doesn't carry these, and session.switchAgent() / session.switchModel() change the whole session right away. This needs a change in core, so it can't be done as a plugin.

    Maintainers will consider it. Related work you may want to follow:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions