Artifacts are rich content objects embedded in chat messages. Learn how the WebSocket delivers them JIT and how to parse and render artifacts like doctor profiles and custom data structures.
Artifacts are structured data objects that provide additional context or information beyond plain text messages. Common examples include:
Artifacts are not fetched via REST API. The WebSocket backend expands artifact tags just-in-time (JIT) during streaming. When the AI references an artifact, the backend replaces the tag with the full artifact JSON and embeds it directly in message.text.
You receive artifact content inline—no separate fetch is needed. The message text contains embedded JSON objects with item_type, item_content, and created_at.
Parse message.text for JSON objects with item_type and item_content:
The inline JSON format embedded in message text:
Doctor profiles are a common artifact type:
The provider_search_results artifact type contains search results from the provider search tool:
The scheduling_progress artifact is a pinned progress indicator emitted during multi-step flows such as appointment scheduling and cancellation. The widget renders the latest emission as a progress bar at the top of the chat modal and hides the tag from the inline message bubble.
Latest emission wins — the agent updates the bar by emitting a new scheduling_progress artifact, and closes the flow by emitting one with completed: true. The progress tag is consumed by the widget; if you parse messages yourself with parseEmbeddedArtifacts, filter it out before rendering.
The createSunnyChat widget automatically parses and renders doctor profiles and provider search results from message text:
Doctor profiles and provider search results are automatically rendered when embedded in messages.
Message text contains JSON blobs—no {art_tag} tags are visible to the client. The backend expands {art_tag}uuid{/art_tag} server-side before streaming. What you receive looks like:
When parsing, handle invalid JSON gracefully:
item_content by item_type