Skip to main content
The Jade SDK provides React hooks for managing AI sessions, streaming, and media extraction. The API is nearly identical across web and React Native.

useJadeSession

The primary hook for managing Jade AI sessions. It handles conversation state, streaming, and media extraction.

Import

Basic Usage

Options

Example with Options

Return Value

Session State

sessionId

Unique identifier for the current session. Created automatically on first message.

conversation

Raw conversation entries from the server.

processedConversation

Processed entries ready for display. Includes:
  • Paired tool calls and results
  • Extracted media URLs
  • Parsed tool inputs/outputs
  • Display metadata (icons, titles)

media

All extracted media from the conversation, sorted by timestamp (most recent first).

Streaming State

isStreaming

Whether the AI is currently generating a response.

streamingText

Current streaming text as it’s being generated.

streamingToolCall

Information about the tool currently being streamed (before execution).

showTinkering

Whether to show a “thinking” indicator (true when AI is processing but not streaming text).

isExecutingTool (React Native only)

Whether a tool is currently being executed on the server.

executingToolName (React Native only)

Name of the tool currently being executed.

Actions

sendMessage

Send a message to start or continue a conversation.

cancel

Cancel the current streaming response.

clear

Clear the local conversation state (doesn’t delete server session).

reconnect

Reconnect to an existing session, resuming from the last event.

loadSession

Load a previous session’s conversation.

useMedia

Extracts all media URLs from a conversation, providing metadata about each generated item.

Import

Usage

Return Value

Returns an array of MediaInfo objects:

Features

  • Deduplication: Media URLs are automatically deduplicated
  • Sorting: Media is sorted by timestamp, most recent first
  • Metadata Extraction: Rich metadata from tool calls

vs useJadeSession.media

useJadeSession already provides media in its return value:

ProcessedEntry

The ProcessedEntry type represents a conversation entry processed for display.

Structure

Rendering Entries

Tool-Specific Rendering

Rendering Suggestions

Text may contain <gr3.suggestion> tags that are parsed into segments:

Client Hooks

Access the underlying client for direct API calls.

React Native-Specific Hooks

These hooks are only available in the React Native package.

useJadeSessionCore

Lower-level session hook without Jade-specific processing. Use when you need raw conversation data.

useStorage

Access the storage adapter:

useAppState

Get the current app state:

Complete Example