> ## Documentation Index
> Fetch the complete documentation index at: https://docs.canary.effectiveai.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Answer an agent's questions

> When an agent stops to ask you something, read its questions and send your answers so it can finish the reply.

An agent stops and asks when it needs a decision it should not make on its own, such as whether a comparison of boatowners coverage should include personal watercraft programs. Its reply then waits until you answer.

This page continues from [Create and run an agent](https://docs.canary.effectiveai.app/guides/agents.md): you have sent an agent a message and are reading that message until it finishes.

## Read the questions

While the agent waits, the message's `status` is `needs_input`, and `userInput` holds its questions, each with suggested options. `reply` holds anything the agent wrote before asking, and can be empty. Abbreviated response:

```json theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
{
  "id": "8fa456c4-037c-452c-82fb-a21e026d9984",
  "status": "needs_input",
  "reply": "",
  "userInput": {
    "id": "3957c416-b149-5ea7-bb11-eb11941a4d24",
    "title": "Scope: personal watercraft",
    "questions": [
      {
        "id": "include_pwc",
        "question": "Should the comparison include personal watercraft programs?",
        "options": [
          {
            "id": "include_them",
            "label": "Include them",
            "description": "Cover personal watercraft (e.g., jet ski) programs alongside boatowners programs."
          },
          {
            "id": "boats_only",
            "label": "Boats only",
            "description": "Limit the comparison to boatowners programs and exclude personal watercraft."
          }
        ]
      }
    ]
  }
}
```

To be told when an agent asks instead of polling, subscribe a [webhook](https://docs.canary.effectiveai.app/guides/webhooks.md) to `session.message.needs_input`.

## Send your answers

Answer each question under its `id`, with an option's `id` or `label` or in your own words. Send the answers to the message that asked:

```bash theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
curl --request POST \
  --url "https://api.canary.effectiveai.app/api/v2/sessions/9fb83b87-f10b-46a5-80cd-fa38e8aa0444/messages/8fa456c4-037c-452c-82fb-a21e026d9984/user-input" \
  --header "Authorization: Bearer $EFFECTIVE_API_KEY" \
  --header "Idempotency-Key: $(uuidgen)" \
  --header 'Content-Type: application/json' \
  --data '{ "answer": { "outcome": "answered", "value": { "include_pwc": "Boats only" } } }'
```

The response is the message, `running` again. Keep reading it as before: the agent carries on with your answers, and its reply arrives in the same message.

To let the agent carry on without answering, send `{ "answer": { "outcome": "skipped" } }`.

Only the person who sent the message can answer, and only once. A second answer returns `409` with the code `user_input_not_requested`.

## Ask fewer questions

Each question holds up the reply until someone answers. For a choice the agent can make on its own, say so in its instructions, as the instructions in [Create and run an agent](https://docs.canary.effectiveai.app/guides/agents.md#save-the-agent) do: "When the request leaves a choice open, such as which carriers to compare, choose the carriers with the most recent filings and say which you chose." To change them, [save a new version](https://docs.canary.effectiveai.app/guides/agents/manage.md#change-the-instructions).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.