/** * LangGraph Adapter * * Integrates LangGraph (LangChain's stateful graph execution framework) * with the SwarmOrchestrator. * * LangGraph models agent workflows as directed graphs with typed state, * conditional edges, and cycles. This adapter wraps user-supplied graph * instances with no hard dependency on the LangGraph package. * * Usage: * const adapter = new LangGraphAdapter(); * adapter.registerGraph('research-flow', myCompiledGraph, { * inputKey: 'messages', * outputKey: 'response', * }); * * @module LangGraphAdapter * @version 1.0.0 */ import { BaseAdapter } from './base-adapter'; import type { AdapterCapabilities, AgentPayload, AgentContext, AgentResult } from '../types/agent-adapter'; /** * Minimal interface for a compiled LangGraph graph. * Compatible with `StateGraph.compile()` output. * Users supply their own LangGraph instance — no hard dependency. */ export interface LangGraphRunnable { invoke(input: Record, config?: Record): Promise>; } /** * Streaming variant — optional, for graphs that support streaming. */ export interface LangGraphStreamable extends LangGraphRunnable { stream(input: Record, config?: Record): AsyncIterable>; } /** Configuration for a registered graph agent */ export interface LangGraphAgentConfig { /** The compiled graph instance */ graph: LangGraphRunnable; /** State key to populate with the agent payload (default: 'messages') */ inputKey?: string; /** State key to read the result from (default: 'response') */ outputKey?: string; /** Optional thread/session ID for checkpointed graphs */ threadId?: string; /** Per-invocation timeout in ms (default: 60000) */ timeoutMs?: number; /** Additional config passed to graph.invoke() */ runnableConfig?: Record; } /** * Adapter for LangGraph stateful agent graphs. * * Each registered graph is exposed as a named agent. The adapter * handles input mapping, timeout enforcement, and result extraction. */ export declare class LangGraphAdapter extends BaseAdapter { readonly name = "langgraph"; readonly version = "1.0.0"; private graphs; get capabilities(): AdapterCapabilities; /** * Register a compiled LangGraph as a named agent. */ registerGraph(agentId: string, graph: LangGraphRunnable, options?: Omit): void; executeAgent(agentId: string, payload: AgentPayload, _context: AgentContext): Promise; shutdown(): Promise; } //# sourceMappingURL=langgraph-adapter.d.ts.map