yield/Documentation

Primitive 03 / Person

AskUser

Pause the workflow for a person. Ask for a choice, missing fact, or approval before the next effect.

01 / When

Use it when code cannot choose for the person.

Use a closed list for approvals and fixed choices. Use a free answer for missing information.

Useful for

  • Approve a releaseAsk before publishing it.
  • Approve a migrationAsk before changing stored data.
  • Choose an environmentLet a person select the target.
  • Provide a missing pathRequest information code cannot know.
  • Approve a policy exceptionRecord the explicit exception.
  • Give final sign-offKeep the decision with a person.
Ask before the effect.Put approval before a publish, migration, deletion, or other irreversible command.
02 / Code

Declare the values your program accepts.

AskUser · TypeScript
import { defineSkill } from "@operatorstack/yield"

defineSkill((ctx) => {
  const answer = ctx.askUser("approve", "Publish this release?", [
  { value: "yes", label: "Publish" },
  { value: "no", label: "Stop" },
])
  if (answer !== "yes") ctx.refused("release not approved")
  return { approved: true }
})
03 / Run

The coding agent presents the typed question.

CursorAskUser · waiting

› /publish-release

Questions1 of 1

1. Publish this release?

Add optional details
∞ AgentGPT-5.6 Medium
Saved response{ "value": "yes" }

Cursor owns the question UI. Yield owns the accepted values and saves the selected value before the workflow continues.

04 / Shape

The value is the program boundary.

Operation ID
A stable name used during replay.
Question
One clear question shown by the coding agent.
Options
Optional value and label pairs.
Answer
The selected value, or free text when no options exist.
05 / Saved

The run can wait on disk.

Yield records the answer and replays it when the program starts again. The same question is not asked again during that run.

Common mistake

Do not ask for approval after the command has changed the system. Use Refused when the person says no.

Set your examples once

Which language are you using?

We’ll open every language-aware example in your choice. You can still switch any individual code block.