Skip to content

feat: add LangChain LangGraph adapter MVP#73

Merged
mertsatilmaz merged 1 commit into
mainfrom
feature/51-langchain-langgraph-adapter-mvp
May 8, 2026
Merged

feat: add LangChain LangGraph adapter MVP#73
mertsatilmaz merged 1 commit into
mainfrom
feature/51-langchain-langgraph-adapter-mvp

Conversation

@mertsatilmaz
Copy link
Copy Markdown
Collaborator

Fixes #51

Describe the changes you have made in this PR

Adds an opt-in langchain adapter so the harness can drive LangChain Runnables
and LangGraph apps as targets, alongside the existing in-process adapter.

  • New src/agent_harness/langchain_adapter.py:
    • build_langchain_input serializes the scenario payload into the
      {"messages": [...]} state shape both Runnables and compiled LangGraphs accept.
    • load_langchain_target resolves module:object import paths and surfaces
      a clear AdapterError when the optional deps are missing.
    • Streams the run and converts LangChain message/tool events into the
      harness's vendor-neutral Trace via TraceRecorder.
  • runner.py and cli.py wired to dispatch to the new adapter when
    --adapter langchain is passed; behavior for the default adapter is unchanged.
  • pyproject.toml: adds a [langchain] extra (langchain + langgraph). Core
    stays vendor-neutral — nothing imported unless the adapter is selected.
  • Example target at examples/targets/langchain_runnable_agent.py.
  • Docs: docs/adapters.md updated 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?

  • No, I wrote all the code myself
  • Yes, I used AI assistance

If you used AI assistance, briefly describe:

  • Tool(s) used:
  • Parts of the contribution that were AI-assisted:
  • How you reviewed the output:
  • Tests or checks I ran:

Checklist before requesting a review

  • I have added proper PR title and linked to the issue
  • I have performed a self-review of my code
  • I can explain the purpose of every documentation, function, class, and logic block I added
  • I understand why my changes work and have tested them thoroughly
  • I have considered potential edge cases and how my code handles them
  • If it is a core feature, I have added thorough tests
  • My code follows the project's style guidelines and conventions

Test plan

  • pytest tests/test_langchain_adapter.py — covers input shaping, import-path
    parsing, missing-deps error, and trace conversion.
  • pytest tests/test_cli.py — covers --adapter langchain dispatch and error
    paths.
  • Manual: agent-harness run … --adapter langchain --target examples.targets.langchain_runnable_agent:agent

@mertsatilmaz mertsatilmaz merged commit b7e03e2 into main May 8, 2026
1 check passed
@mertsatilmaz mertsatilmaz deleted the feature/51-langchain-langgraph-adapter-mvp branch May 8, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add LangChain/LangGraph adapter MVP

1 participant