feat: add LangChain LangGraph adapter MVP#73
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #51
Describe the changes you have made in this PR
Adds an opt-in
langchainadapter so the harness can drive LangChain Runnablesand LangGraph apps as targets, alongside the existing in-process adapter.
src/agent_harness/langchain_adapter.py:build_langchain_inputserializes the scenario payload into the{"messages": [...]}state shape both Runnables and compiled LangGraphs accept.load_langchain_targetresolvesmodule:objectimport paths and surfacesa clear
AdapterErrorwhen the optional deps are missing.harness's vendor-neutral
TraceviaTraceRecorder.runner.pyandcli.pywired to dispatch to the new adapter when--adapter langchainis passed; behavior for the default adapter is unchanged.pyproject.toml: adds a[langchain]extra (langchain + langgraph). Corestays vendor-neutral — nothing imported unless the adapter is selected.
examples/targets/langchain_runnable_agent.py.docs/adapters.mdupdated with install + usage; README cross-links it.Code Understanding and AI Usage
Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code or documentation?
If you used AI assistance, briefly describe:
Checklist before requesting a review
Test plan
pytest tests/test_langchain_adapter.py— covers input shaping, import-pathparsing, missing-deps error, and trace conversion.
pytest tests/test_cli.py— covers--adapter langchaindispatch and errorpaths.
agent-harness run … --adapter langchain --target examples.targets.langchain_runnable_agent:agent