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

# Streaming components

> Yield strings for markdown or dicts for rich components: thinking bubbles, tables, code, callouts, images and client actions.

An agent body yields two kinds of value. Strings render as markdown. Dicts render
as components. Both stream as they are produced, so the interface fills in while
the model is still working.

```python theme={null}
@cycls.agent(web=web, volumes={"/workspace": chats})
async def demo(context):
    yield {"type": "status", "status": "Checking the fleet"}

    yield "Here is what I found:\n\n"

    yield {"type": "table", "headers": ["Server", "Status", "CPU"]}
    yield {"type": "table", "row": ["web-1", "Online", "45%"]}
    yield {"type": "table", "row": ["web-2", "Offline", "0%"]}

    yield {"type": "code", "code": "systemctl restart web-2", "language": "bash"}
    yield {"type": "callout", "callout": "web-2 needs attention.", "style": "warning"}
```

## Component reference

| Type | Required keys | Behavior |
| - | - | - |
| `text` | `text` | accumulates into one block. A bare string is the same thing |
| `thinking` | `thinking` | accumulates into a collapsible bubble |
| `code` | `code`, `language` | accumulates into one block |
| `table` | `headers` or `row` | renders row by row |
| `callout` | `callout`, `style`, optional `title` | one card of plain text, with links made clickable. `style` is `info`, `warning`, `error` or `success`. `title` adds a bold heading, and an `error` callout on the last message offers Retry |
| `status` | `status` | a single line that replaces the previous status |
| `image` | `src`, optional `alt`, `caption` | one image, its caption under it. Images next to each other form a grid |
| `sources` | `sources` | citation chips from `[{title, url, snippet}]`. A source may also carry `label`, the chip's words in place of the site's name, and `quote`, `status` and `note` for its card. A link in the text to a source's `url` becomes its chip |
| `step` | `step`, optional `tool_name`, `id`, `ok`, `args`, `result`, `connector`, `icon` | a tool step line. A later step with the same `id` updates it, and `ok: False` marks it failed. A `result` opens it into Request and Response panes that hold the `args` and `result` strings. `connector` shows that connector's logo, and `icon` an image URL in its place. `picture`, such as `"16:9"`, holds a frame of that shape while the step runs |
| `usage` | `used`, `limit`, optional `per`, `resets` | an agent's limit. In its last fifth, a line above the composer counts what is left. The reply that uses the last of it opens the plans as it ends, once a period on each device, and a reply refused for it is a note that thanks the person and offers the plans. Not stored |
| `ui` | `action` | a client action, not rendered and not stored |

HTML in a string shows as text, not markup. To show a page, write it to a
workspace file and open it with the `open_canvas` [client action](#client-actions).

A reloaded chat is rebuilt from the model's turns: their text, thinking and tool
steps, the sources any tool returned, and the files tools opened. Everything else,
including text the body yields itself, shows only while the turn streams.

## Thinking

Consecutive `thinking` yields append to the same bubble until a different type
arrives. Provider reasoning deltas map here automatically, so extended thinking
from Anthropic and `delta.reasoning` from OpenAI-compatible endpoints both show
up without any work on your side.

```python theme={null}
yield {"type": "thinking", "thinking": "Checking the invoice totals "}
yield {"type": "thinking", "thinking": "against last month."}
yield "The totals match."
```

## Tables

Send the header row once, then one `row` per record. Rows render as they arrive,
so a slow query shows partial results instead of nothing.

```python theme={null}
yield {"type": "table", "headers": ["Region", "Revenue"]}
for region, revenue in await query():
    yield {"type": "table", "row": [region, f"{revenue:,.0f}"]}
```

## Client actions

A `ui` event triggers something in the client. Nothing is rendered in the
conversation and nothing is kept in history.

```python theme={null}
used = await messages_this_month(context.user)
if used >= 14:
    yield {"type": "usage", "used": used, "limit": 14, "per": "month", "resets": "2026-11-01"}
    yield {"type": "ui", "action": "open_plan_modal", "reason": "limit"}
    return
```

| Action | Fields | Effect |
| - | - | - |
| `open_plan_modal` | optional `reason` | opens the [plans window](https://docs.cycls.com/web/monetization.md#the-plans-window). The client picks user or organization plans based on the active org, and reports `reason`, such as `limit`, to [analytics](https://docs.cycls.com/web/interface.md#analytics-and-push). After a used-up `usage`, `limit` opens the window by itself once per period on each device, and the note in the reply carries it after that |
| `open_canvas` | `path`, optional `name` | opens a workspace file in the canvas viewer |
| `suggest` | `text` | one follow-up chip above the composer |
| `ask` | `questions` | a question card above the composer, up to three questions |
| `confirm` | `tool`, `key`, optional `label`, `args`, `connector` | an approval card in the conversation, in place of the call's step. Approving sends a hidden message that puts `key` in [`context.approvals`](https://docs.cycls.com/agents/context), and Not now puts it in `context.declined` |
| `connect` | `connector` | a card asking the user to connect that [connector](https://docs.cycls.com/agents/connectors.md) |
| `compacted` | `tier`, `reason`, `tokens`, `ok` | the loop compacted the context. Nothing shows, and the client reports it to analytics |

Apart from `open_plan_modal`, these come from the [built-in tools](https://docs.cycls.com/agents/tools.md),
[connectors](https://docs.cycls.com/agents/connectors.md) and the loop. Yield them directly only from a
custom loop. The turn ends after the `Suggest` and `Ask` tools, and after a
tool returns `confirm` or `connect`, because what comes next is the user's.

## Errors

An unhandled exception inside the body becomes an `error` callout with a short
reference id, which the callout also carries as `error_id`, and the full traceback
goes to structured logs.

```
Something went wrong. Reference: abc12345
```

Look it up with the reference:

```bash theme={null}
cycls logs my-agent --query 'jsonPayload.error_id="abc12345"'
```

A run the server loses before it finishes, to a deploy, a crash or the 45-minute
cap, ends with "Stopped before it finished" under the reply and a **Continue**
button, which sends "Continue" as the next message.

Some errors never reach a callout, because the loop recovers from them. A rate
limit, an overload or a server error from the model is retried with backoff up to
10 times, shown as one `step` line that counts the attempts. A tool that fails or
times out returns an `Error:` result to the model, which decides what to do next.

## Next

> [card] [Context](https://docs.cycls.com/agents/context.md)
>
> What the body receives on every turn.


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