Components / AI interfaces
Reasoning and tool calls
A folding block for a model's reasoning, and a row for each tool it calls with its status.
Functions: cui_reasoning, cui_tool_call

Usage
cui_reasoning(ui, "think", .thinking = streaming, .seconds = elapsed) {
cui_text(ui, thoughts, .size = 13.5f, .color = CUI_COLOR_TEXT_SECONDARY);
}
cui_tool_call(ui, "search", "web_search", .icon = CUI_ICON_GLOBE, .detail = query, .status = CUI_TASK_DONE, .seconds = 1.4f,
.input = request_json, .output = response_json);
cui_tool_call(ui, "read", "read_file", .detail = "quarterly-report.pdf", .status = CUI_TASK_RUNNING);
While thinking, the reasoning header shimmers and counts up; when it ends, the block folds to "Thought for 8s". Clicking the header opens or closes it, and from then on your choice sticks. A tool call shows its status as a ring, a spinner, a check or a cross, with the time. Clicking it opens the input and output, which are highlighted as JSON when they look like JSON.
Keyboard
- Tab focuses a reasoning block's header or a tool call, and Enter or Space folds or unfolds it.
Options of cui_reasoning
| Option | Type | Default | Description |
|---|---|---|---|
.thinking | bool | still thinking: the header shimmers and the body opens; it folds when this turns false | |
.seconds | float | time spent, for the header: "Thinking for 12s", then "Thought for 12s" | |
.title | const char * | header text to show instead of the "Thinking" and "Thought for" lines |
Options of cui_tool_call
| Option | Type | Default | Description |
|---|---|---|---|
.status | cui_task_status | One of CUI_TASK_PENDING, CUI_TASK_RUNNING, CUI_TASK_DONE, CUI_TASK_FAILED or CUI_TASK_SKIPPED. | |
.icon | const char * | An icon: a CUI_ICON_* constant, or a string from another icon font. | |
.detail | const char * | muted text after the tool's name, e.g. the file or query it works on | |
.input | const char * | what was sent to the tool; the row then opens to show it (as JSON when it parses) | |
.output | const char * | what the tool returned, shown when open; labelled "Error" when the status is failed | |
.seconds | float | how long the call took, shown at the end of the row unless it is pending; 0 hides it |
Related
- Agent plan and status: The steps an agent is working through, and a pill that says what it is doing now.
- Sources and citations: Citations inside an answer and the list of sources they point to.
- Composer and model picker: The message box of a chat, with attachments, send and stop, and a menu for choosing the model.
- Suggestions, response actions and the context meter: Prompt suggestions to start from, the actions under a response, and a ring that shows how full the context is.