Human step
A human step is a point in a pipeline where a person must answer a typed question before the run continues. Pipeline code opens it like any other step, and gets back an answer of the type it asked for.
Some decisions belong to a person, such as whether to deliver a code change or what an agent does when its task is unclear. A human step asks that person at a fixed point of the pipeline, records the answer in the run journal and continues with it. The run waits without a running agent, so an answer can take a minute or a week. After this page you know how a run waits at a human step, where a person answers, which answers it accepts, and how an agent’s questions reach a human step.
How it works
Section titled “How it works”The release pipeline asks whether to publish a release, and stops the run when the answer is no:
import codeband as cb
@cb.function_stepdef publish(version: str) -> str: return f"published {version}"
@cb.pipelinedef release(version: str) -> None: question = cb.Question(text=f"Publish release {version}?") if not cb.human_step("approve", question, answer=bool): raise cb.Stop(f"a person rejected release {version}")
publish(version)- The first invocation that reaches the human step finds no record of it. The engine writes the question and the answer type’s JSON Schema to the run journal as the step
approve#0, and the run’s status becomeswaiting. - Nothing runs while the run waits: no agent, no function step and no invocation.
- A person answers. The engine sends the answer to the code server in a new invocation, which checks it against the answer type and its validators.
- The run journal records the first accepted answer and the user who gave it, and the pipeline continues with it: here, to the function step
publish. - Every later invocation returns the recorded answer at once, as a run replay does for every recorded step.
When stdin is a terminal, codeband run asks the question itself:
codeband run my-pipelines/release --input '{"version": "1.2.0"}'Started run k6xxhm00pn▸ approve#0 human step opensHuman step approve#0 asks: { "options": [], "text": "Publish release 1.2.0?" }Answer y or n: y✓ approve#0 answered by ada after 3.2s✓ publish#0 function stepno code changeThe terminal shows the question as JSON indented by two spaces. A text field of several lines, such as the end of a failed test output, shows as its lines without quotes, each indented under the field’s name.
Where a person answers
Section titled “Where a person answers”| Place | How |
|---|---|
The terminal of codeband run |
Asks each human step’s question while it follows the run, when stdin is a terminal |
codeband answer |
Answers from another terminal, with --json or by asking the question in the terminal |
| The web interface | The page for the run, in the web interface, shows the question and a form built from the answer type. The guide Answer a human step in the web interface shows it |
| The thread of a GitHub issue | A run that a GitHub issue started posts each question in the issue’s thread. Only a comment by a person with write access to the repository answers it |
| The thread of a GitHub issue | A run that a GitHub issue starts posts its human step questions in the issue’s thread, and people answer there |
When stdin is not a terminal, codeband run prints the command that answers the human step:
Started run sd0r2tjg21▸ approve#0 human step opensRun sd0r2tjg21 waits for an answer to human step approve#0. Answer it with: codeband answer sd0r2tjg21 approve#0 --json '<answer>'codeband answer sd0r2tjg21 --json falseAnswered human step approve#0 of run sd0r2tjg21The run ends with stopped: a person rejected release 1.2.0. Without a human step ID, codeband answer answers the run’s only open human step.
Who may answer
Section titled “Who may answer”The daemon’s socket accepts only the user who runs the daemon, so through the CLI only that user can answer. The daemon reads the user at the other end of each request from its socket, and the run journal records that user with the answer. codeband web and codeband dev call the daemon on that socket, so an answer from the web interface records the user who runs the one that serves it.
Several answers can reach the same human step, such as from two terminals or from a terminal and the web interface. The run checks them one after the other, records the first one it accepts and refuses every later answer to that human step.
Answer types
Section titled “Answer types”The answer type decides what a person can answer, how the terminal asks for it and which form the web interface shows. The code server checks every answer against that type, so pipeline code gets a value it can use and never parses free text.
| Answer type | The terminal asks | The web interface shows |
|---|---|---|
| Yes or no | Answer y or n: |
A checkbox |
| One of fixed values, such as an enum | A numbered list and Choose a number: |
A choice of the values |
| Text | One line after Answer: |
A text box, or a text area for text with a text media type or a maximum length over 200 characters |
| A number | One line after Answer with a number: |
A text box |
| An object or a list | Opens the editor of $VISUAL or $EDITOR (vi when neither is set) on a JSON file |
A field for each property, and a list field for a list of the types above. Any other type opens in a JSON editor |
| Several questions, one answer each | Each question with its numbered suggested answers | The questions as JSON, and a list field with one answer for each question |
The last row is the type for an agent’s questions. Here the human step clarify#0 asks two questions:
Human step clarify#0 asks 2 questions.
Question 1 of 2: Which branch gets the fix? 1) main 2) release-1.2Answer with a number or your own text: 2
Question 2 of 2: Who reviews it?Answer: adaA rejected answer changes nothing in the run journal, and the human step stays open. The terminal prints The run did not take the answer: with the reason and asks again. The form of the web interface shows the reason and stays open. codeband answer prints the reason and exits with code 1:
codeband answer sd0r2tjg21 --json '"maybe"'answer: answer rejected: human step approve#0 does not accept the answer: 1 validation error for bool Input should be a valid boolean, unable to interpret input [type=bool_parsing, input_value='maybe', input_type=str] For further information visit https://errors.pydantic.dev/2.14/v/bool_parsingWhen an agent needs a person
Section titled “When an agent needs a person”An agent never waits for a person inside an agent step. An agent that cannot go on without a decision ends its agent step with an agent question: its questions for a person. Your pipeline asks those questions at a human step with several questions, and passes the answers to a new agent step of the agent. The answers go into the step request of the new agent step.
An agent step that paused for a person would hold a harness process for hours, and fail where nothing can wait, such as on a CI runner. It could also not be recorded and replayed as one unit.
A run that goes over a budget on agent steps or cost also stops at a human step.
While a run waits
Section titled “While a run waits”Ctrl-C in the terminal of codeband run or codeband cancel cancels a waiting run and closes its open human steps.
A run that waits at a human step still waits after the daemon restarts, and takes the answer then.
Rules for your pipeline code
Section titled “Rules for your pipeline code”Put what the person needs into the question
Section titled “Put what the person needs into the question”The person sees only the question, so give it the facts the decision needs, such as the version or the title of a code change. The run journal keeps the question next to the answer, so a later reader sees what the person decided on.
Ask for the type you act on
Section titled “Ask for the type you act on”Ask for a yes or no, or one of fixed values, when the pipeline branches on the answer. Keep free text for answers that go into a prompt.
Name the human step after the decision
Section titled “Name the human step after the decision”The name is part of the human step’s step ID, such as approve#0, which codeband answer takes. The second call of a human step with the same name in a run is approve#1.
Related
Section titled “Related”- Answer a human step adds a human step to a pipeline and answers it in the terminal of
codeband runand withcodeband answer. - Run explains the run journal and the ways a run ends.
- Agent step explains how an agent step ends with an agent question.
- Run replay explains why a recorded answer comes back on every later invocation.
codeband answerlists the flags and exit codes, and the Python SDK reference listscb.human_step,cb.Questionsandcb.Answers.