Skip to main content
Tool renderers let you display custom UI — like charts, tables, or cards — directly inside the chat when a server-side tool returns data.

How It Works

  1. Agent calls a tool — The backend executes a server-side tool and returns structured data
  2. Result arrives via SSE — The tool_result event streams back with the tool name and result payload
  3. Widget checks toolRenderers — If a renderer exists for that tool name, it renders your component
  4. Custom component appears inline — Your chart/table/card renders directly below the tool call status

Setup

1. Define Your Renderers

Create React components that accept { result, status } props:

2. Pass to the Widget


Renderer Props

Each renderer receives:
Renderers are only called when the tool completes successfully (status === "complete") and the result is not null. You don’t need to check for these conditions.

Example: Chart Renderer

Here’s a full example rendering a Recharts line chart from analytics tool results:

TypeScript

Import the ToolRenderers type for type-safe renderer maps:

Without a Renderer

When no toolRenderers entry exists for a tool, the widget shows the default behavior: a checkmark with the tool name and “done” status. Adding a renderer enhances this — it doesn’t replace the status indicator, it adds your component below it.