[Adapter] LangGraph export/runner
Summary
Add a LangGraph adapter to gitagent, enabling export and run support for the LangGraph framework.
Details
LangGraph is a popular framework for building stateful, multi-agent applications with LLMs. A gitagent adapter would allow users to:
- Export: Convert a gitagent agent definition to a LangGraph graph/state machine
- Run: Execute a gitagent-defined agent using the LangGraph runtime
Acceptance Criteria
- [ ]
gitagent export --format langgraphgenerates valid LangGraph Python code - [ ]
gitagent run ./agent --adapter langgraphexecutes the agent - [ ] Documentation added to README adapter table
- [ ] Example added to
examples/
Resources
- LangGraph docs
- Existing adapters in
src/adapters/for reference
https://docs.langchain.com/oss/python/deepagents/overview
DeepAgent instead.
Hi @shreyas-lyzr, you mentioned DeepAgent as a potential alternative.
Could you clarify:
- Is the current LangGraph PR complete or does it need work?
- Should we pursue DeepAgent implementation instead of LangGraph?
- If DeepAgent is preferred, would you like me to work on that adapter?
I'd be happy to help implement whichever approach you think is best.
https://docs.langchain.com/oss/python/deepagents/overview
DeepAgent instead.
Apologies for the long silence. Still wanted, still open. With the LangChain adapter (PR #16) in flight, LangGraph becomes interesting because it's the natural sibling.
Mapping I think is right:
agent.yaml→ LangGraphStateGraphconfig (model, max_turns, etc.)skills/→ LangGraph nodes (each skill becomes a callable node)skillflows/*.yaml→ LangGraph edges + conditional routing (this is the natural fit — gitagent's SkillsFlow is conceptually equivalent to a LangGraph state graph)tools/→ LangGraph tool bindingshooks/pre_tool_use→ LangGraphbefore_toolcallback (LangGraph supports this)- Sub-agents (
agents/<name>/) → nested LangGraph graphs
The skillflows/ ↔ LangGraph correspondence is genuinely close — implementing this adapter would also stress-test our SkillsFlow design and likely surface useful spec questions.
Sequencing: Easier to do after PR #16 (LangChain) lands, since LangGraph imports a lot of LangChain primitives — sharing adapter helpers would be cleaner.
Open to anyone who wants to take it. help wanted. Apologies for the wait.
Resolved by #80 (LangGraph + DeepAgents adapters merged 2026-05-13). Thanks @krishvsoni for shipping both flavors.
Reopening — #80 hit a merge conflict (with the just-merged #66 mcp_servers PR, which also touches export.ts and adapters/index.ts). Will close again once #80 lands after rebase.
PR #80 addresses this issue — it adds both langgraph and deepagents adapters. Currently in review. Status:
src/adapters/langgraph.tsconverts agent.yaml → LangGraphStateGraph(skills → nodes, skillflows → edges/conditional routing, tools → ToolNode)src/adapters/deepagents.tsconverts agent.yaml →create_deep_agent(...)call (LLM-orchestrated, no graph wiring)- 18 LangGraph tests + 13 DeepAgents tests
- Example agents in
examples/langgraph/andexamples/deepagents/
Two blocking issues flagged in the PR review: (1) no runner implementation for gitagent run -a langgraph, and (2) the anthropic:claude-sonnet-4-5 provider prefix format needs verification against the adapter's provider detection logic. Once those are resolved the PR should be mergeable.
Tracking here — will close this issue when #80 merges.
PR #80 (feat/1-langgraph-adapter by @krishvsoni) directly addresses this issue and is currently open for review. It adds both LangGraph (StateGraph) and DeepAgents adapters with comprehensive test coverage — 18 tests for LangGraph and 13 for DeepAgents.
Key items from the PR review that should be resolved before close:
- Skills listed in agent.yaml but absent from skillflows will generate isolated graph nodes that are never reached — this should warn at export time
- SKILLS = ["./skills"] in deepagents output uses a relative path that will break if the script is run from a different directory
- src/adapters/index.ts was not updated to export the DeepAgents adapter, so it will not be accessible via the top-level package export
Once those are addressed in PR #80, this issue can be closed. Assigning @shreyas-lyzr to coordinate.
Thanks for the thorough review @shreyas-lyzr, all four points are addressed in the latest push.
1. Skills with no skillflow entry (silent unreachable nodes)
Fixed both ways you suggested. The LangGraph adapter now detects skills that are declared in agent.yaml but referenced by no skillflow step, and it:
- warns at export time on stderr —
gitagent: skill "<name>" is declared but no skillflow step references it; it will not be reachable in the compiled graph. - emits a note in the generated module itself listing the unreferenced skills, right under their node definitions.
When there are no skillflows, skills are chained sequentially as before, so nothing is silently orphaned.
2. SKILLS = ["./skills"] relative path
Now resolved relative to the generated file instead of the CWD:
SKILLS = [str(Path(__file__).resolve().parent / "skills")]
Same treatment for sub-agent skills (Path(__file__).resolve().parent / "agents" / "<name>" / "skills"). from pathlib import Path is only imported when skills are actually present.
3. NotImplementedError stubs
The stub raises a descriptive message at runtime — raise NotImplementedError("Implement tool: <name>") — so anyone running the file gets a clear, tool-specific signal, and both example READMEs call out that stubs must be replaced. Happy to add an inline # TODO: implement comment above the raise as well if you'd prefer it visible without running the file.
4. index.ts missing the DeepAgents export
Exported: exportToDeepAgents / exportToDeepAgentsString are in src/adapters/index.ts, and the adapter is wired into both export (--format deepagents) and run (-a deepagents).
On the two blocking items from the PR review:
- Runners : added
runners/langgraph.tsandrunners/deepagents.ts(sharing a smallrunners/python.tshelper), sogitagent run -a langgraph|deepagentsworks instead of falling through.-pis honored via aGITAGENT_PROMPTenv var the entrypoint reads. anthropic:claude-sonnet-4-5prefix : confirmed correct as-is: the string is passed straight toinit_chat_model()(LangGraph) andcreate_deep_agent(model=...)(DeepAgents), both of which parseprovider:modelnatively. Stripping the prefix would actually break provider selection, so no change there.
Both example expected_output.py snapshots were regenerated and match the live CLI output exactly; the full test suite stays green (31 adapter tests).