open-swe/apps/open-swe/src/utils/langgraph-client.ts
Brace Sproul ff8a0f7167
[WIP] feat: New multi agent GitHub based workflow (#175)
* feat: New multi agent GitHub based workflow

* fix: read plan from gh issue in init issue node

* format

* cr

* fix how new planner threads are started, allow for creating new issues

* fix: read tasks from gh issue inside manager when taking any action

* cr

* update planner

* feat: port intrerrupt node to planner

* add interrupt routing in graph

* update programmer nodes and state

* read messages from issue in programmer

* lint fix

* tag issue when opening PR

* better pr title and body generation prompts

* start runs from planner interrupt and update issue with task plan

* fix lg server build issues

* cr

* fix cloning and pushing

* cr

* cr

* feat: v0 copy (#194)

* feat: v0 copy

* cr

* all pages 'working'

* cr

* cr

* cr

* cr
2025-06-18 11:03:39 -07:00

20 lines
602 B
TypeScript

import { Client } from "@langchain/langgraph-sdk";
export function createLangGraphClient(options?: {
defaultHeaders?: Record<string, string>;
includeApiKey?: boolean;
}) {
if (!process.env.LANGGRAPH_API_URL) {
throw new Error("LANGGRAPH_API_URL not found");
}
if (options?.includeApiKey && !process.env.LANGGRAPH_API_KEY) {
throw new Error("LANGGRAPH_API_KEY not found");
}
return new Client({
...(options?.includeApiKey && {
apiKey: process.env.LANGGRAPH_API_KEY,
}),
apiUrl: process.env.LANGGRAPH_API_URL,
defaultHeaders: options?.defaultHeaders,
});
}