Interface: UseChatOptions<TResponse>
Defined in: react/src/hooks/useChat.ts:38
Configuration options for useChat hook
Type Parameters
TResponse
TResponse = string
Properties
chatBot?
optionalchatBot?:Processable<string,TResponse>
Defined in: react/src/hooks/useChat.ts:69
Optional: Provide your own Processable (e.g., Pipeline) to use as chatBot
fetch?
optionalfetch?: typeoffetch
Defined in: react/src/hooks/useChat.ts:89
Optional: Custom fetch implementation (e.g., expo/fetch for React Native streaming)
headers?
optionalheaders?:Record<string,string>
Defined in: react/src/hooks/useChat.ts:87
Optional: Extra headers to include in proxy requests (e.g., Authorization)
maxToolIterations?
optionalmaxToolIterations?:number
Defined in: react/src/hooks/useChat.ts:58
Maximum tool call iterations (default: 50)
model?
optionalmodel?:string|ModelConfig|AISDKLanguageModel
Defined in: react/src/hooks/useChat.ts:40
Model to use (default: gpt-5.6-luna) - can be string or provider-specific model
onApprovalRequest?
optionalonApprovalRequest?: (approval) =>void
Defined in: react/src/hooks/useChat.ts:75
Callback when a tool requires approval before execution. Called for tools with requiresApproval: true. Return { approved: true } to allow, or { approved: false, reason: '...' } to deny.
Parameters
approval
Returns
void
onError?
optionalonError?: (error) =>void
Defined in: react/src/hooks/useChat.ts:62
Error callback
Parameters
error
Error
Returns
void
onEvent?
optionalonEvent?: (event,meta?) =>void
Defined in: react/src/hooks/useChat.ts:67
Callback for every raw stream event. Called before segment reduction. Use for logging, analytics, custom side effects, or filtering tool sub-events (e.g. crew worker events).
Parameters
event
meta?
agentId?
string
agentName?
string
Returns
void
proxyUrl?
optionalproxyUrl?:string
Defined in: react/src/hooks/useChat.ts:60
Proxy URL for API requests (optional) - use this to avoid CORS errors in the browser
responseSchema?
optionalresponseSchema?:unknown
Defined in: react/src/hooks/useChat.ts:56
Schema for the assistant's response structure (optional) Can be a JSON Schema object or a Zod schema for type safety If not provided, defaults to simple text responses
sessionId?
optionalsessionId?:string
Defined in: react/src/hooks/useChat.ts:85
Optional: Session ID for server-side persistence. Forwarded to the proxy via providerOptions.
shouldAskApproval?
optionalshouldAskApproval?: (toolName) =>boolean
Defined in: react/src/hooks/useChat.ts:81
Function to check if a tool should ask for approval. Return false to auto-approve, true to show approval UI. If not provided, all tools with requiresApproval will trigger onApprovalRequest.
Parameters
toolName
string
Returns
boolean
skills?
optionalskills?:Skill[]
Defined in: react/src/hooks/useChat.ts:50
Skills available to the assistant — keyword-triggered instruction sheets
that bundle their own tools. Emits skill_activated stream events when one
shapes a turn (surfaced via onSkillActivated / the segment stream).
storage?
optionalstorage?:HistoryStorage
Defined in: react/src/hooks/useChat.ts:83
Optional: Provide custom storage for history persistence (e.g., SupabaseStorage). Defaults to in-memory.
systemPrompt?
optionalsystemPrompt?:string
Defined in: react/src/hooks/useChat.ts:42
System prompt for the assistant
tools?
optionaltools?:Record<string,ZodToolDefinition<ZodType<unknown,unknown,$ZodTypeInternals<unknown,unknown>>,unknown> |ToolDefinition<(...args) =>unknown>>
Defined in: react/src/hooks/useChat.ts:44
Tools available to the assistant