# question

Canonical URL: https://developers.iagenify.com/sdk/agent/events/question/
Language: en

`{ type: "question", id, question, options }`

The agent is asking you something and has stopped to wait. Same shape as a permission, different meaning: here it wants an answer, not an approval.

Status: needs onQuestion · the loop waits · question_result follows

## Fields {#fields}

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `id` | string |  | Generated for this question. |
| `question` | string |  | What it is asking. |
| `options` | array |  | Suggested answers, when it offered any. |

## It needs onQuestion {#requires}

```javascript
const agent = api.agents.create({
  runtime: "local", machine: pc, model,
  onQuestion: async ({ question, options }) => {
    console.log(question, options);
    return await readAnswerFromTheUser();     // a string
  },
  onEvent: (e) => {
    if (e.type === "question")        showQuestion(e.id, e.question, e.options);
    if (e.type === "question_result") closeQuestion(e.id, e.answer);
  },
});
```

> **Without onQuestion there is no ask_user**
>
> The tool is only wired when the callback is there. An agent without it has no way to ask, and is instructed to make a judgement call or explain what is blocking instead — which is a different run, not a stuck one.

## question_result {#result}

```javascript
{ type: "question_result", id, answer }    // "" when nothing was returned
```

An empty answer is passed to the agent as an empty answer; it is not an error, and the loop continues.

## When it asks {#when}

- The request is ambiguous and the choice is the user's.
- Two attempts at the same approach have failed — it is told to ask rather than try a third.

## A subagent never asks {#subagents}

`ask_user` is one of the three tools a subagent does not get. It is told it cannot talk to the user and must report back instead — so a question always comes from the main run, and never carries `parentId`.

- [ask_user](/sdk/agent/tools/ask-user): The tool.
- [permission](/sdk/agent/events/permission): The same shape, for approvals.

```python
def on_question(request):
    print(request["question"], request["options"])
    return read_answer_from_the_user()     # a string

agent = api.agents.create(runtime="local", machine=pc, model=model, on_question=on_question)
```

```python
# The ask_user tool returns what on_question answered, or None when no callback is set
{"answer": "the second option"}
```
