open-swe/apps/open-swe-v2/src/agent.ts
Palash Shah 46d795c41b
feat: open swe v2 in js! (#797)
* feat: openswe v2

* feat: yarn lock

* update: add eslint

* update: working build & lint

* chore: update types

* chore: format

* reorg agent v2

* cleanup

* fixes

* nits: modifications

* feat: updates

* nit: update yarn lock

* nit: don't add dep to root

* chore: update yarn

* chore: update langgraph.json

* nit: update names

* chore: update functions

* nit: update

---------

Co-authored-by: bracesproul <braceasproul@gmail.com>
2025-08-27 09:49:54 -04:00

21 lines
855 B
TypeScript

import "@langchain/langgraph/zod";
import { createDeepAgent } from "deepagents";
import { codeReviewerAgent, testGeneratorAgent } from "./subagents.js";
import { getCodingInstructions } from "./prompts.js";
import { createAgentPostModelHook } from "./post-model-hook.js";
import { CodingAgentState } from "./state.js";
import { executeBash, httpRequest, webSearch } from "./tools.js";
const codingInstructions = getCodingInstructions();
const postModelHook = createAgentPostModelHook();
const agent = createDeepAgent({
tools: [executeBash, httpRequest, webSearch],
instructions: codingInstructions,
subagents: [codeReviewerAgent, testGeneratorAgent],
isLocalFileSystem: true,
postModelHook: postModelHook,
stateSchema: CodingAgentState,
}).withConfig({ recursionLimit: 1000 }) as any;
export { agent, executeBash, httpRequest, webSearch };