);
}
```
### Streaming State
| Property | Type | Description |
| ------------- | --------- | --------------------------- |
| `isIdle` | `boolean` | Not generating |
| `isWaiting` | `boolean` | Waiting for server response |
| `isStreaming` | `boolean` | Actively streaming response |
The `streamingState` object provides additional detail:
```tsx
const { streamingState } = useTambo();
// streamingState.status: "idle" | "waiting" | "streaming"
// streamingState.runId: current run ID
// streamingState.error: { message, code } if error occurred
```
### Content Block Types
Messages contain an array of content blocks. Handle each type:
| Type | Description | Key Fields |
| ------------- | ---------------------- | ------------------------ |
| `text` | Plain text | `text` |
| `component` | AI-generated component | `id`, `name`, `props` |
| `tool_use` | Tool invocation | `id`, `name`, `input` |
| `tool_result` | Tool response | `tool_use_id`, `content` |
| `resource` | MCP resource | `uri`, `name`, `text` |
### Submit Options
```tsx
const { submit } = useTamboThreadInput();
await submit({
threadId: "specific-thread", // Override target thread
toolChoice: "auto", // "auto" | "required" | "none" | { name: "toolName" }
maxTokens: 4096, // Max response tokens
systemPrompt: "Be helpful", // Override system prompt
});
```
## Fetching a Thread by ID
To fetch a specific thread (e.g., for a detail view), use `useTamboThread(threadId)`:
```tsx
import { useTamboThread } from "@tambo-ai/react";
function ThreadView({ threadId }: { threadId: string }) {
const { data: thread, isLoading, isError } = useTamboThread(threadId);
if (isLoading) return ;
if (isError) return
Failed to load thread
;
return
{thread.name}
;
}
```
This is a React Query hook - use it for read-only thread fetching, not for the active conversation.
## Thread List
Manage multiple conversations:
```tsx
import { useTambo, useTamboThreadList } from "@tambo-ai/react";
function ThreadSidebar() {
const { data, isLoading } = useTamboThreadList();
const { currentThreadId, switchThread, startNewThread } = useTambo();
if (isLoading) return ;
return (
{data?.threads.map((t) => (
))}
);
}
```
### Thread List Options
```tsx
const { data } = useTamboThreadList({
userKey: "user_123", // Filter by user (defaults to provider's userKey)
limit: 20, // Max results
cursor: nextCursor, // Pagination cursor
});
// data.threads: TamboThread[]
// data.hasMore: boolean
// data.nextCursor: string
```
## Suggestions
AI-generated follow-up suggestions after each assistant message:
```tsx
import { useTamboSuggestions } from "@tambo-ai/react";
function Suggestions() {
const { suggestions, isLoading, accept, isAccepting } = useTamboSuggestions({
maxSuggestions: 3, // 1-10, default 3
autoGenerate: true, // Auto-generate after assistant message
});
if (isLoading) return ;
return (