@agentskit/react β Functions
API functions for @agentskit/react.
#Function: ChatContainer()
ChatContainer(
props):Element
Defined in: react/src/components/ChatContainer.tsx:18
Render chat children in a container that scrolls to new content.
#Parameters
#props
The container children and optional class name.
#Returns
Element
The chat container element.
#Example
<ChatContainer>{messages.map(message => <Message key={message.id} message={message} />)}</ChatContainer>#Function: CodeBlock()
CodeBlock(
props):Element
Defined in: react/src/components/CodeBlock.tsx:15
Render code and optionally show a button that copies it to the clipboard.
#Parameters
#props
The code, optional language, and copy control flag.
#Returns
Element
The code block element.
#Function: ConfirmUndoCard()
ConfirmUndoCard(
props):Element
Defined in: react/src/components/ConfirmUndoCard.tsx:30
Approve or deny an action; after approval, offer an undo until the window closes.
#Parameters
#props
Labels, undo window, and callbacks.
#Returns
Element
The card element.
#Function: createChatController()
createChatController(
initial):ChatController
Defined in: core/dist/index.d.ts:42
Create a chat controller from adapter, conversation, and optional integrations.
#Parameters
#initial
Adapter, prompt, tool, memory, and observer settings.
#Returns
Controller methods for managing the session and reading its state.
#Example
`const chat = createChatController({ adapter }); await chat.send('Hello')`.#Function: createInMemoryMemory()
createInMemoryMemory(
initialMessages?):ChatMemory
Defined in: core/dist/index.d.ts:173
Create a message-memory backend that stores data in the current process.
#Parameters
#initialMessages?
Optional messages to seed the store.
#Returns
A ChatMemory implementation backed by an in-memory array.
#Function: createLocalStorageMemory()
createLocalStorageMemory(
key):ChatMemory
Defined in: core/dist/index.d.ts:179
Create a browser-local-storage backend using the supplied storage key.
#Parameters
#key
string
Local storage key for the serialized message record.
#Returns
A ChatMemory implementation backed by browser local storage.
#Throws
MemoryError from load, save, or clear when storage access fails.
#Function: createStaticRetriever()
createStaticRetriever(
config):Retriever
Defined in: core/dist/index.d.ts:189
Create a retriever that returns configured documents for each query.
#Parameters
#config
StaticRetrieverConfig
Documents to expose through the retriever.
#Returns
A retriever that returns the configured documents.
#Function: formatRetrievedDocuments()
formatRetrievedDocuments(
documents):string
Defined in: core/dist/index.d.ts:194
Format retrieved documents into text suitable for a model prompt.
#Parameters
#documents
Retrieved content and metadata to format.
#Returns
string
A labeled text block containing the document contents.
#Function: InputBar()
InputBar(
props):Element
Defined in: react/src/components/InputBar.tsx:20
Render a chat input that sends on submit or Enter without Shift.
#Parameters
#props
The chat actions, placeholder, and optional disabled flag.
#Returns
Element
The chat input form.
#Example
<InputBar chat={chat} />#Function: Markdown()
Markdown(
props):Element
Defined in: react/src/components/Markdown.tsx:14
Display content as text and mark it while the response is streaming.
#Parameters
#props
The content and optional streaming state.
#Returns
Element
The marked content element.
#Function: Message()
Message(
props):Element
Defined in: react/src/components/Message.tsx:16
Render a chat message with role, status, and optional content slots.
#Parameters
#props
The message and optional avatar and action elements.
#Returns
Element
The message element.
#Function: ThinkingIndicator()
ThinkingIndicator(
props):Element|null
Defined in: react/src/components/ThinkingIndicator.tsx:14
Render a thinking indicator when visible is true.
#Parameters
#props
The visibility flag and optional label.
#Returns
Element | null
The indicator element or null.
#Function: ToolCallView()
ToolCallView(
props):Element
Defined in: react/src/components/ToolCallView.tsx:14
Render a tool call summary with a toggle for arguments and results.
#Parameters
#props
The tool call to display.
#Returns
Element
The tool call element.
#Function: ToolConfirmation()
ToolConfirmation(
props):Element|null
Defined in: react/src/components/ToolConfirmation.tsx:28
Render approval controls only while the tool call needs confirmation.
#Parameters
#props
The tool call and its approval and denial callbacks.
#Returns
Element | null
The confirmation element or null.
#Function: TopologyGraphView()
TopologyGraphView(
props):Element
Defined in: react/src/components/TopologyGraphView.tsx:72
Render a subscribed multi-agent topology graph as an SVG.
Clicking a node calls onNodeClick when provided.
#Parameters
#props
The topology source, optional click callback, and dimensions.
#Returns
Element
The graph SVG element.
#Example
<TopologyGraphView source={graph} onNodeClick={(id) => openSession(id)} />#Function: UsageMeter()
UsageMeter(
props):Element|null
Defined in: react/src/components/UsageMeter.tsx:34
Show how much of a cost window is used, with warning and out states.
#Parameters
#props
The cost window, threshold, and labels.
#Returns
Element | null
The meter element, or null when the window has no cap.
#Function: useChat()
useChat(
config):ChatReturn
Defined in: react/src/useChat.ts:20
Create or reuse a chat controller and expose its state and actions.
#Parameters
#config
The configuration supplied to the core chat controller.
#Returns
Chat state and the controller's send, stop, retry, and tool actions.
#Example
const chat = useChat({ adapter })
return <InputBar chat={chat} />#Function: useReactive()
useReactive<
T>(initialState):T
Defined in: react/src/useReactive.ts:14
Create a shallow reactive proxy that rerenders this hook's consumer on writes.
#Type Parameters
#T
T extends Record<string, unknown>
#Parameters
#initialState
T
The initial top-level state properties.
#Returns
T
A proxy whose property assignments notify subscribers.
#Example
const state = useReactive({ count: 0 })
return <button onClick={() => state.count++}>{state.count}</button>#Function: useStream()
useStream(
source,options?):UseStreamReturn
Defined in: react/src/useStream.ts:16
Consume a stream source and expose its latest chunk, text, status, and error.
#Parameters
#source
The async stream source to consume.
#options?
Optional callbacks for chunks, completion, and errors.
#Returns
Stream state and a stop() action.
#Example
const stream = useStream(source)
return <pre>{stream.text}</pre>