# Running Jobs

A Job is one execution of an Assignment. Use `duvo runs` to start Jobs, check status, stream messages, respond to human-in-the-loop requests, and stop running Jobs.

## Starting and inspecting Jobs

```bash
duvo runs start --agent <agent-id>             # start a Job
duvo runs get <run-id>                         # get Job status
duvo runs messages <run-id>                    # list conversation messages
duvo runs stop <run-id>                        # stop a running Job
```

Add `--json` to any command for machine-readable output suitable for scripting.

## Mid-run interaction

Send a message to a Job in progress (for example, to add clarifying instructions):

```bash
duvo runs send-message <run-id> \
  --message "Please also check the backup."
```

## Responding to humans-in-the-loop

When an Assignment pauses to ask a human a question or request approval, you can respond from the CLI:

```bash
duvo runs respond <run-id> --approve                  # approve a human request
duvo runs respond <run-id> --deny                     # deny a human request
duvo runs respond <run-id> \
  --answer "<question-id>=<answer-text>"             # answer a pending question
```

The `--answer` flag takes a `<question-id>=<answer-text>` pair. Find the `<question-id>` by running `duvo runs messages <run-id>` and looking at the pending human request.

## Scripting examples

### Start a Job and wait for it to finish

```bash
RUN_ID=$(duvo runs start --agent "$AGENT_ID" --json | jq -r '.run.id')

while true; do
  STATUS=$(duvo runs get "$RUN_ID" --json | jq -r '.run.status')
  case "$STATUS" in
    completed|failed|stopped) break ;;
  esac
  sleep 5
done

echo "Job $RUN_ID finished with status: $STATUS"
```

### Auto-approve any pending human requests on a Job

Useful in trusted batch pipelines where every approval is expected to pass:

```bash
duvo runs messages "$RUN_ID" --json \
  | jq -r '.messages[] | select(.type=="human_request" and .status=="pending") | .id' \
  | xargs -I {} duvo runs respond "$RUN_ID" --approve
```

### Forward Job output to a script

```bash
duvo runs messages "$RUN_ID" --json \
  | jq -r '.messages[] | select(.role=="assistant") | .content' \
  > job-output.log
```

## Related

* [Managing Assignments](/cli/managing-assignments.md) — list and configure the Assignments you can start
* [Cases and Queues](/cli/cases-and-queues.md) — when Jobs are kicked off by Cases on a Queue


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.duvo.ai/cli/running-jobs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
