| Renderer | R Documentation |
Renderer is the canonical, UI-agnostic contract for presenting an agent's
streaming output. The agent runtime (driven by stream_text() /
run_agent_runtime()) emits agent-output events purely through these
semantic methods, so the same agent-output logic can be rendered in a
terminal (the built-in cli backend, create_stream_renderer()), a web app
(e.g. aisdk.shiny), a test/replay harness (create_capture_renderer()),
or any custom UI – by implementing this interface.
The agent-output event model captures what an agent does as it responds:
text – streamed assistant text, delivered incrementally via
process_chunk(text, done); the final call usually has text = NULL and
done = TRUE.
thinking – a reasoning stream bracketed by start_thinking()
and stop_thinking().
tools – tool execution: render_tool_start(name, arguments)
followed by render_tool_result(name, result, success, raw_result).
steps – multi-step ReAct loop boundaries, reset_for_new_step().
Every method is a no-op in the base class, so the base class is itself a usable null renderer and a subclass need only override the events it cares about.
process_chunk()Render a chunk of streamed assistant text.
Renderer$process_chunk(text, done = FALSE)
textA character chunk, or NULL on the final (done) call.
doneTRUE when the current text segment is complete.
Invisibly NULL.
start_thinking()Signal the start of a thinking/reasoning stream.
Renderer$start_thinking()
Invisibly NULL.
stop_thinking()Signal the end of a thinking/reasoning stream.
Renderer$stop_thinking()
Invisibly NULL.
render_tool_start()Render the start of a tool call.
Renderer$render_tool_start(name, arguments)
nameTool name.
argumentsTool arguments (a list).
Invisibly NULL.
render_tool_result()Render a tool result.
Renderer$render_tool_result(name, result, success = TRUE, raw_result = NULL)
nameTool name.
resultThe display result.
successWhether the tool call succeeded.
raw_resultThe raw (unformatted) result.
Invisibly NULL.
reset_for_new_step()Reset transient render state at a new ReAct step boundary.
Renderer$reset_for_new_step()
Invisibly NULL.
clone()The objects of this class are cloneable with this method.
Renderer$clone(deep = FALSE)
deepWhether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.