feat(adapters): added LangGraph and DeepAgents export adapters#80
feat(adapters): added LangGraph and DeepAgents export adapters#80krishvsoni wants to merge 2 commits into
Conversation
|
This is a serious piece of work. Brutally honest review: What's right:
One thing for a follow-up (not a blocker): Merging. |
|
Hit a clean merge conflict — PR #66 (mcp_servers) just merged minutes before this and also touches Quick rebase needed against the new main. The conflict footprint is tiny: just the two integration files at the bottom of the export switch and the adapters/index re-exports. The actual If you push a rebase, I'll merge same-day (less than an hour if I'm at a keyboard). If easier, I'm happy to rebase locally and force-push to your branch myself — your call. Either way the merge is approved on the substance. Apologies for the conflict — that one was on me. |
- Implemented and functions in to convert agent configurations into LangGraph Python code. - Created a comprehensive test suite in to validate the output of the export functions, ensuring correct handling of agent metadata, skills, tools, skillflows, and hooks. - Added helper functions for YAML rendering and agent directory structure creation to facilitate testing. - Ensured compatibility with existing agent structures by supporting both and directories.
711dd4e to
08d3d13
Compare
|
Thanks @shreyas-lyzr no worries on the conflict, totally understandable timing. Rebased onto main and force-pushed. The One small extra: README.md also had a tiny conflict against PR #78's adapter table additions (copilot/codex/kiro/gitclaw). Resolved by keeping all rows the table now lists every upstream adapter, plus langgraph and deepagents at the bottom. Net diff against main is just +2 lines on README, as expected. |
|
@shreyas-lyzr Can you check now? |
shreyas-lyzr
left a comment
There was a problem hiding this comment.
Good addition — LangGraph and DeepAgents together give users both the explicit-graph and the LLM-orchestrated path. The example agents are well-structured and the test counts look solid (18 + 13 tests). A few items before merge:
Blocking: langgraph.ts — missing runner
PR #81 (LangChain) ships both an adapter (langchain.ts) and a runner (runners/langchain.ts). This PR adds adapters for LangGraph and DeepAgents but the diff doesn’t include runners/langgraph.ts or runners/deepagents.ts. Without runners, gitagent run -a langgraph will either error or fall through to an unhandled case. Is runner support planned as a follow-up? If so, note it explicitly and update src/commands/run.ts to show a clear "runner not yet implemented" error rather than a silent failure.
Blocking: agent.yaml uses anthropic:claude-sonnet-4-5 prefix format
The examples/deepagents/agent.yaml specifies anthropic:claude-sonnet-4-5 but provider detection in the existing adapter code (and in PR #81) strips the prefix and matches on the model name portion. Confirm the adapter handles the provider:model format correctly, or strip the prefix in deepagents.ts before detection.
Suggestion: shared expected_output.py snapshot strategy
Both example directories commit an expected_output.py. These will drift from the actual adapter output over time unless CI verifies them. Consider adding a CI step that regenerates and diffs, or at least add a note in CONTRIBUTING.md that these need updating when the adapter changes.
Suggestion: TOOLS passed to sub-agent in DeepAgents example
In expected_output.py the fact_checker_subagent dict includes "tools": TOOLS — the same tools as the parent agent. In most fact-checking patterns the sub-agent should have its own, narrower tool set. The example as-is will work, but it may mislead users into giving sub-agents unnecessarily broad tool access.
Minor: README adapter table in PR #80 vs #81
Both PRs add rows to README.md’s adapter table. If both are targeting the same base commit they will conflict. One of them needs to include the other’s row, or the second to merge will need a rebase.
Once the runner story is clarified and the model-prefix handling confirmed, this is close to mergeable.
shreyas-lyzr
left a comment
There was a problem hiding this comment.
Large PR but well-organized. The LangGraph and DeepAgents adapters are clearly distinct and the examples are a great addition. Key observations:
-
In langgraph.ts, skill nodes are generated as individual graph nodes but the skillflow edges use depends_on from skillflows YAML. If a skill is listed in agent.yaml but has no corresponding skillflow entry, it gets added as an isolated node with no edges — it will never be reached during graph execution. This is a silent correctness issue. Either warn at export time, or document this behavior clearly.
-
The deepagents.ts adapter uses SKILLS = ["./skills"] and assumes DeepAgents will discover SKILL.md files from a relative path. This path is relative to where the generated Python script is run from, not where it lives. If the script is moved or run from a different working directory, skill discovery will silently fail. Embedding the absolute path or documenting the run directory requirement would help.
-
Both adapters generate NotImplementedError stubs for tool implementations. The deepagents expected_output.py in the example directory uses NotImplementedError but the README says the generated file leaves tool implementations as NotImplementedError stubs — replace them. This is fine as documentation but should also be a comment in the generated output itself so users running the file get a clear message.
-
The deepagents adapter exports exportToDeepAgents and exportToDeepAgentsString but the index.ts export list was not updated in this PR (only the LangGraph adapter appears there). The DeepAgents adapter will not be accessible via the top-level package export unless index.ts is updated.
-
Test coverage for both adapters looks thorough. The 18 LangGraph tests and 13 DeepAgents tests cover the main cases well.
…port, update documentation, and improve example scripts
feat(adapters): added LangGraph and DeepAgents export adapters
exportToLangGraphandexportToLangGraphStringfunctions insrc/adapters/langgraph.tsto convert agent configurations into LangGraph Python code.exportToDeepAgentsandexportToDeepAgentsStringfunctions insrc/adapters/deepagents.tsto emit acreate_deep_agent(...)LangChain DeepAgents harness — skills, tools, and sub-agents map directly; no graph wiring.src/adapters/langgraph.test.ts(18 tests) andsrc/adapters/deepagents.test.ts(13 tests) to validate the output of the export functions, ensuring correct handling of agent metadata, skills, tools, skillflows, hooks, and sub-agents.skillflows/andworkflows/directories.What
Adds two new export adapters to gitagent:
langgraph: converts a gitagent directory into a runnable LangGraphStateGraphPython module. Skills become nodes,skillflows/*.yamlbecomeadd_edge/add_conditional_edges,tools/*.yamlbind to aToolNode,pre_tool_usehooks become abefore_toolcallback, andagents/<name>/become nested compiledStateGraphs.deepagents: converts a gitagent directory into acreate_deep_agent(...)call. Skills are passed viaskills=["./skills"](DeepAgents reads eachSKILL.mdnatively), tools are@tooldefs intools=[...], and sub-agents becomeSubAgentdicts insubagents=[...]. Use this when you want the model to orchestrate planning and delegation instead of authoring a graph by hand.Why
Issue #1 has been open since Feb 27 and the @shreyas-lyzr 's most recent comment asked for LangGraph proper as the natural sibling of the in-flight LangChain adapter (PR #16), with the explicit mapping
agent.yaml → StateGraph config,skills/ → nodes,skillflows/*.yaml → edges + conditional routing. The maintainer's earlier comment in the same thread linked the DeepAgents overview as a possible alternative — shipping it as a sibling adapter gives users both paths (explicit graph wiring vs. LLM-orchestrated harness) without forcing a choice.Closes #1
How Tested
npm run buildpassesgitagent validatepasses on example agentsRan both adapters end-to-end against
examples/langgraph,examples/deepagents, and the bundledexamples/fullcompliance agent (sub-agents, workflow withdepends_on, hooks, FINRA / Federal Reserve / SEC compliance block). Diffed each export against the committedexpected_output.pyand verified syntactic validity withast.parse. Full suite is 60/60 across 11 suites — 18 new LangGraph tests + 13 new DeepAgents tests, no pre-existing tests modified.Checklist