import { AsyncCaller, AsyncCallerParams } from "../utils/async_caller.js"; import { StreamProtocol } from "../types.js"; //#region src/client/base.d.ts type HeaderValue = string | undefined | null; /** * Get the API key from the environment. * Precedence: * 1. explicit argument (if string) * 2. LANGGRAPH_API_KEY * 3. LANGSMITH_API_KEY * 4. LANGCHAIN_API_KEY * * @param apiKey - API key provided as an argument. If null, skips environment lookup. If undefined, tries environment. * @returns The API key if found, otherwise undefined */ declare function getApiKey(apiKey?: string | null): string | undefined; type RequestHook = (url: URL, init: RequestInit) => Promise | RequestInit; /** * Configuration for {@link BaseClient} and the exported LangGraph SDK * {@link Client}. */ interface ClientConfig { /** * Base URL of the LangGraph API server. * * Defaults to `http://localhost:8123`, unless the runtime provides a * `langgraph_api:url` global override. */ apiUrl?: string; /** * API key for authentication. * - If a string is provided, that key will be used * - If undefined (default), the key will be auto-loaded from environment variables (LANGGRAPH_API_KEY, LANGSMITH_API_KEY, or LANGCHAIN_API_KEY) * - If null, no API key will be set (skips auto-loading) */ apiKey?: string | null; /** * Options forwarded to the internal {@link AsyncCaller}, such as retry, * concurrency, or custom `fetch` behavior. */ callerOptions?: AsyncCallerParams; /** * Default timeout, in milliseconds, applied to client requests. * * Per-request `timeoutMs` values override this default. Passing `null` * at the request level disables the configured timeout for that request. */ timeoutMs?: number; /** * Headers applied to every request. * * The configured API key, when present, is added as the `x-api-key` * header after these defaults are initialized. */ defaultHeaders?: Record; /** * Hook for inspecting or mutating a request before it is sent. * * Receives the resolved URL and prepared `RequestInit`; return the * original init or a replacement object to continue the request. */ onRequest?: RequestHook; /** * Streaming protocol used by stream-capable endpoints. * * Defaults to `"legacy"` for backwards compatibility. */ streamProtocol?: StreamProtocol; } declare class BaseClient { protected asyncCaller: AsyncCaller; protected timeoutMs: number | undefined; protected apiUrl: string; protected defaultHeaders: Record; protected onRequest?: RequestHook; protected streamProtocol: StreamProtocol; constructor(config?: ClientConfig); protected prepareFetchOptions(path: string, options?: RequestInit & { json?: unknown; params?: Record; timeoutMs?: number | null; withResponse?: boolean; }): [url: URL, init: RequestInit]; protected fetch(path: string, options: RequestInit & { json?: unknown; params?: Record; timeoutMs?: number | null; signal: AbortSignal | undefined; withResponse: true; }): Promise<[T, Response]>; protected fetch(path: string, options?: RequestInit & { json?: unknown; params?: Record; timeoutMs?: number | null; signal: AbortSignal | undefined; withResponse?: false; }): Promise; protected streamWithRetry(config: { endpoint: string; method?: string; signal?: AbortSignal; headers?: Record; params?: Record; json?: unknown; maxRetries?: number; onReconnect?: (options: { attempt: number; lastEventId?: string; cause: unknown; }) => void; onInitialResponse?: (response: Response) => void | Promise; }): AsyncGenerator; } //#endregion export { BaseClient, ClientConfig, HeaderValue, RequestHook, getApiKey }; //# sourceMappingURL=base.d.ts.map