CaptureRenderer: Capturing Agent Output Renderer

CaptureRendererR Documentation

Capturing Agent Output Renderer

Description

A Renderer that records every agent-output event into an in-memory log instead of displaying it – useful for testing, replay, and reusing agent-output logic in non-terminal UIs.

Super class

aisdk::Renderer -> CaptureRenderer

Public fields

log

A list of recorded events, each a list with a type field.

Methods

Public methods


Method new()

Create a capturing renderer with an empty log.

Usage
CaptureRenderer$new()

Method process_chunk()

Record a streamed text chunk.

Usage
CaptureRenderer$process_chunk(text, done = FALSE)
Arguments
text

A character chunk, or NULL.

done

TRUE when the text segment is complete.


Method start_thinking()

Record the start of a thinking stream.

Usage
CaptureRenderer$start_thinking()

Method stop_thinking()

Record the end of a thinking stream.

Usage
CaptureRenderer$stop_thinking()

Method render_tool_start()

Record the start of a tool call.

Usage
CaptureRenderer$render_tool_start(name, arguments)
Arguments
name

Tool name.

arguments

Tool arguments.


Method render_tool_result()

Record a tool result.

Usage
CaptureRenderer$render_tool_result(
  name,
  result,
  success = TRUE,
  raw_result = NULL
)
Arguments
name

Tool name.

result

The display result.

success

Whether the tool call succeeded.

raw_result

The raw result.


Method reset_for_new_step()

Record a ReAct step boundary.

Usage
CaptureRenderer$reset_for_new_step()

Method events()

Return the recorded events.

Usage
CaptureRenderer$events()
Returns

A list of recorded events.


Method clone()

The objects of this class are cloneable with this method.

Usage
CaptureRenderer$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


aisdk documentation built on May 29, 2026, 9:07 a.m.