AgentProviderProps
Unpublished development API. This package is under development and is not available as a published release.
What AgentProvider takes.
import type { AgentProviderProps } from '@threadplane/react';Declaration
export interface AgentProviderProps<TSession extends HostedSession> {
readonly children?: ReactNode;
readonly createSession: (context: AgentSessionFactoryContext) => Promise<TSession>;
readonly onThreadId?: (threadId: string) => void;
readonly threadId?: string | null;
}Type parameters
TSessionHostedSession
Members
children
readonly children?: ReactNode;createSession
Creates the session for one thread, asynchronously, so the backend package
can load on demand:
(context) => import('@threadplane/langgraph').then((m) => m.createSession({ ...options, ...context })).
Called when the provider mounts and again for each threadId change. The
latest function is used, so an inline arrow is fine.
readonly createSession: (context: AgentSessionFactoryContext) => Promise<TSession>;onThreadId
Called with the id of a thread a session created.
readonly onThreadId?: (threadId: string) => void;threadId
The thread to show. A change switches threads.
readonly threadId?: string | null;