@threadplane/langgraph 0.0.49 → 0.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { BaseMessage, AIMessage } from '@langchain/core/messages';
|
|
|
4
4
|
import * as _langchain_langgraph_sdk from '@langchain/langgraph-sdk';
|
|
5
5
|
import { ThreadState, Config, Checkpoint, Command, Metadata, StreamMode, BagTemplate, Interrupt, ToolCallWithResult, ToolProgress, Client } from '@langchain/langgraph-sdk';
|
|
6
6
|
export { BagTemplate, InferBag, Interrupt, ThreadState } from '@langchain/langgraph-sdk';
|
|
7
|
-
import { AgentRuntimeTelemetrySink, AgentWithHistory, AgentSubmitInput, AgentSubmitOptions, Message, AgentStatus, ToolCall, AgentInterrupt, Subagent, AgentCheckpoint, MockAgent, MockAgentOptions, Citation, Thread } from '@threadplane/chat';
|
|
7
|
+
import { AgentRuntimeTelemetrySink, AgentWithHistory, AgentSubmitInput, AgentSubmitOptions, ClientToolsCapability, Message, AgentStatus, ToolCall, AgentInterrupt, Subagent, AgentCheckpoint, MockAgent, MockAgentOptions, Citation, Thread } from '@threadplane/chat';
|
|
8
8
|
import { MessageMetadata } from '@langchain/langgraph-sdk/ui';
|
|
9
9
|
export { SubmitOptions } from '@langchain/langgraph-sdk/ui';
|
|
10
10
|
import { FakeAgentConfig } from '@threadplane/chat/testing';
|
|
@@ -166,6 +166,23 @@ interface AgentTransport {
|
|
|
166
166
|
}): Promise<void>;
|
|
167
167
|
}
|
|
168
168
|
/** Options for creating a LangGraph-backed agent via {@link agent}. */
|
|
169
|
+
/**
|
|
170
|
+
* Tuning options for the underlying LangGraph SDK `Client` constructed by the
|
|
171
|
+
* default {@link FetchStreamTransport}. Ignored when a custom `transport` is
|
|
172
|
+
* supplied (the transport owns its own client).
|
|
173
|
+
*/
|
|
174
|
+
interface LangGraphClientOptions {
|
|
175
|
+
/**
|
|
176
|
+
* How many times a failed request — including the initial stream connect —
|
|
177
|
+
* is retried with exponential backoff before the error surfaces. Maps to the
|
|
178
|
+
* SDK's `callerOptions.maxRetries`. Omitted → the SDK default (currently 4).
|
|
179
|
+
*
|
|
180
|
+
* Set `0` to fail fast: useful for e2e tests that force a connection failure
|
|
181
|
+
* and assert the error surfaces promptly, rather than after the full
|
|
182
|
+
* multi-second backoff window.
|
|
183
|
+
*/
|
|
184
|
+
maxRetries?: number;
|
|
185
|
+
}
|
|
169
186
|
interface AgentOptions<T, _ResolvedBag extends BagTemplate> {
|
|
170
187
|
/** Base URL of the LangGraph Platform API. Defaults to `provideAgent({ apiUrl })` when omitted. */
|
|
171
188
|
apiUrl?: string;
|
|
@@ -183,6 +200,8 @@ interface AgentOptions<T, _ResolvedBag extends BagTemplate> {
|
|
|
183
200
|
toMessage?: (msg: unknown) => BaseMessage;
|
|
184
201
|
/** Custom transport. Defaults to FetchStreamTransport. */
|
|
185
202
|
transport?: AgentTransport;
|
|
203
|
+
/** Tuning options for the default transport's LangGraph SDK client (e.g. retry budget). */
|
|
204
|
+
clientOptions?: LangGraphClientOptions;
|
|
186
205
|
/** Optional app-owned telemetry sink. No telemetry is emitted unless this is provided. */
|
|
187
206
|
telemetry?: AgentRuntimeTelemetrySink | false;
|
|
188
207
|
/** When true, subagent messages are filtered from the main messages signal. */
|
|
@@ -224,6 +243,13 @@ interface LangGraphAgent<T = unknown, ResolvedBag extends BagTemplate = BagTempl
|
|
|
224
243
|
experimentalBranchTree: Signal<AgentBranchTree<T>>;
|
|
225
244
|
/** Submit input, resume commands, checkpoint forks, or other LangGraph run options. */
|
|
226
245
|
submit: (input: AgentSubmitInput | null | undefined, opts?: AgentSubmitOptions & LangGraphSubmitOptions) => Promise<void>;
|
|
246
|
+
/**
|
|
247
|
+
* Client-declared, client-executed tools. Call setCatalog() to register
|
|
248
|
+
* tool specs; the catalog is automatically shipped with every run via
|
|
249
|
+
* `input.client_tools`. Pending tool calls appear in pending() after
|
|
250
|
+
* the run ends; resolve() returns a result and continues the run.
|
|
251
|
+
*/
|
|
252
|
+
clientTools: ClientToolsCapability;
|
|
227
253
|
/** Current agent state values (raw, typed per the type parameter T). */
|
|
228
254
|
value: Signal<T>;
|
|
229
255
|
/** True once at least one value or message has been received. */
|
|
@@ -301,6 +327,8 @@ interface AgentConfig<T = Record<string, unknown>, _Bag extends BagTemplate = Ba
|
|
|
301
327
|
toMessage?: (msg: unknown) => BaseMessage;
|
|
302
328
|
/** Custom transport. Defaults to {@link FetchStreamTransport}. */
|
|
303
329
|
transport?: AgentTransport;
|
|
330
|
+
/** Tuning options for the default transport's LangGraph SDK client (e.g. retry budget). */
|
|
331
|
+
clientOptions?: LangGraphClientOptions;
|
|
304
332
|
/** Optional app-owned telemetry sink. No telemetry is emitted unless this is provided. */
|
|
305
333
|
telemetry?: AgentRuntimeTelemetrySink | false;
|
|
306
334
|
/** When true, subagent messages are filtered from the main messages signal. */
|
|
@@ -442,8 +470,9 @@ declare class FetchStreamTransport implements AgentTransport {
|
|
|
442
470
|
/**
|
|
443
471
|
* @param apiUrl - Base URL of the LangGraph Platform API
|
|
444
472
|
* @param onThreadId - Optional callback invoked when a new thread is created
|
|
473
|
+
* @param clientOptions - Optional SDK client tuning (e.g. `maxRetries`)
|
|
445
474
|
*/
|
|
446
|
-
constructor(apiUrl: string, onThreadId?: (id: string) => void);
|
|
475
|
+
constructor(apiUrl: string, onThreadId?: (id: string) => void, clientOptions?: LangGraphClientOptions);
|
|
447
476
|
/** Open a streaming connection, creating a thread if needed. */
|
|
448
477
|
stream(assistantId: string, threadId: string | null, payload: unknown, signal: AbortSignal, options?: LangGraphSubmitOptions): AsyncIterable<StreamEvent>;
|
|
449
478
|
/** Join an already-started run without creating a new thread. */
|
|
@@ -558,17 +587,34 @@ declare function extractCitations(msg: KwargsLike): Citation[] | undefined;
|
|
|
558
587
|
* transport (`fetch-stream.transport.ts`) and the threads adapter
|
|
559
588
|
* (`LangGraphThreadsAdapter`) both go through here.
|
|
560
589
|
*
|
|
590
|
+
* `clientOptions.maxRetries` maps to the SDK's `callerOptions.maxRetries`,
|
|
591
|
+
* which governs how many times a failed request (including the initial
|
|
592
|
+
* stream connect) is retried with exponential backoff before the error
|
|
593
|
+
* surfaces. Omitted → the SDK default (currently 4). Apps under test set
|
|
594
|
+
* `0` so a forced connection failure surfaces immediately instead of after
|
|
595
|
+
* the full backoff window.
|
|
596
|
+
*
|
|
561
597
|
* @example
|
|
562
598
|
* ```ts
|
|
563
599
|
* const client = createLangGraphClient(environment.langGraphApiUrl);
|
|
564
600
|
* const threads = await client.threads.search({ limit: 50 });
|
|
565
601
|
* ```
|
|
566
602
|
*/
|
|
567
|
-
declare function createLangGraphClient(apiUrl: string): Client;
|
|
603
|
+
declare function createLangGraphClient(apiUrl: string, clientOptions?: LangGraphClientOptions): Client;
|
|
568
604
|
/** Exported separately so non-Client callers (e.g. raw fetch) can
|
|
569
605
|
* share the same normalization logic. */
|
|
570
606
|
declare function toAbsoluteApiUrl(apiUrl: string): string;
|
|
571
607
|
|
|
608
|
+
/**
|
|
609
|
+
* App-wide LangGraph SDK client tuning (e.g. `maxRetries`). Provide once at the
|
|
610
|
+
* app root; both the agent's default {@link FetchStreamTransport} and the
|
|
611
|
+
* {@link LangGraphThreadsAdapter} read it so the retry budget is configured in
|
|
612
|
+
* one place. A call-site `agent({ clientOptions })` or per-agent
|
|
613
|
+
* `provideAgent({ clientOptions })` overrides it for that agent.
|
|
614
|
+
* Absent → the SDK default.
|
|
615
|
+
*/
|
|
616
|
+
declare const LANGGRAPH_CLIENT_OPTIONS: InjectionToken<LangGraphClientOptions>;
|
|
617
|
+
|
|
572
618
|
/**
|
|
573
619
|
* Configuration consumed by {@link LangGraphThreadsAdapter}. Provide
|
|
574
620
|
* via {@link LANGGRAPH_THREADS_CONFIG} (typically in app.config.ts):
|
|
@@ -620,6 +666,7 @@ declare const LANGGRAPH_CLIENT: InjectionToken<Client<_langchain_langgraph_sdk.D
|
|
|
620
666
|
*/
|
|
621
667
|
declare class LangGraphThreadsAdapter {
|
|
622
668
|
private readonly config;
|
|
669
|
+
private readonly sharedClientOptions;
|
|
623
670
|
private readonly client;
|
|
624
671
|
private readonly fallback;
|
|
625
672
|
private readonly _threads;
|
|
@@ -687,5 +734,5 @@ declare function refreshOnRunEnd(agent: LangGraphAgent, fn: () => void | Promise
|
|
|
687
734
|
*/
|
|
688
735
|
declare function refreshOnTransition<T>(watch: Signal<T>, isActive: (v: T) => boolean, fn: () => void | Promise<void>): void;
|
|
689
736
|
|
|
690
|
-
export { AGENT_LIFECYCLE, AgentLifecycleRegistry, FakeStreamTransport, FetchStreamTransport, LANGGRAPH_CLIENT, LANGGRAPH_THREADS_CONFIG, LangGraphThreadsAdapter, MockAgentTransport, ResourceStatus, createLangGraphClient, extractCitations, injectAgent, mockLangGraphAgent, provideAgent, provideFakeAgent, refreshOnRunEnd, refreshOnTransition, toAbsoluteApiUrl };
|
|
691
|
-
export type { AgentBranchTree, AgentBranchTreeFork, AgentBranchTreeNode, AgentConfig, AgentLifecycle, AgentOptions, AgentQueue, AgentQueueEntry, AgentTransport, CustomStreamEvent, LangGraphAgent, LangGraphMultitaskStrategy, LangGraphSubmitOptions, LangGraphThreadsConfig, MockLangGraphAgent, StreamEvent, SubagentStreamRef };
|
|
737
|
+
export { AGENT_LIFECYCLE, AgentLifecycleRegistry, FakeStreamTransport, FetchStreamTransport, LANGGRAPH_CLIENT, LANGGRAPH_CLIENT_OPTIONS, LANGGRAPH_THREADS_CONFIG, LangGraphThreadsAdapter, MockAgentTransport, ResourceStatus, createLangGraphClient, extractCitations, injectAgent, mockLangGraphAgent, provideAgent, provideFakeAgent, refreshOnRunEnd, refreshOnTransition, toAbsoluteApiUrl };
|
|
738
|
+
export type { AgentBranchTree, AgentBranchTreeFork, AgentBranchTreeNode, AgentConfig, AgentLifecycle, AgentOptions, AgentQueue, AgentQueueEntry, AgentTransport, CustomStreamEvent, LangGraphAgent, LangGraphClientOptions, LangGraphMultitaskStrategy, LangGraphSubmitOptions, LangGraphThreadsConfig, MockLangGraphAgent, StreamEvent, SubagentStreamRef };
|