@threadplane/chatFunctionv0.3.4

createAgentRef

Create a typed agent handle.

import { createAgentRef } from '@threadplane/chat';

Declaration · overload 1

export declare function createAgentRef<TState>(debugName?: string): AgentRef<TState>;

Type parameters

TState

Parameters

debugName · optional
string

Optional name shown in Angular DI error messages.

Returns

AgentRef<TState>

An AgentRef carrying a state-typed InjectionToken.

Examples

interface TripState { day: number; places: string[]; }
export const TRIP = createAgentRef<TripState>('trip');
// app.config.ts: provideAgent(TRIP, { assistantId: 'trip' })
// component:     const agent = injectAgent(TRIP); // LangGraphAgent<TripState>