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

# Answer the agent

> Supply on_question / on_confirm to run interactively.

Passing handlers makes the run interactive — the app forwards the agent's
`ask_user` and `confirm_action` to your callbacks (over MCP elicitation) while
`.text()` runs. There's no event loop to drive; the handlers are called as
needed, and they may block on a human for up to \~2 minutes.

```python theme={null}
from cosmon_agent_sdk import Client, Question, Confirmation

def answer(question: Question) -> str:
    # question.options lists any offered choices ([] if free-form)
    return input(f"{question.prompt} {question.options or ''}\n> ")

def approve(confirmation: Confirmation) -> bool:
    return input(f"{confirmation.summary} — approve? [y/N] ").strip().lower() == "y"

with Client(on_question=answer, on_confirm=approve) as client:
    print(client.run("Run a static structural study on bracket.sldprt", agent="solidworks").text())
```

The two handlers are independent: with only `on_confirm`, the run is question-free
(the agent is never offered `ask_user`) but every approval gate reaches your
handler; with only `on_question`, questions reach you while confirmations
auto-resolve (approve safe, decline dangerous).

<Card title="Guide: attended vs unattended" icon="book-open" href="/sdk/guide#attended-vs-unattended">
  The full handler matrix, timeouts, and the safe-by-default rule.
</Card>
