1010from agent_harness .runner import (
1111 dry_run_scenario ,
1212 run_scenario_live ,
13+ run_scenario_with_langchain_target ,
1314 run_scenario_with_mcp_target ,
1415 run_scenario_with_openai_agent ,
1516 run_scenario_with_python_target ,
@@ -98,6 +99,17 @@ def build_parser() -> argparse.ArgumentParser:
9899 "in module:function format."
99100 ),
100101 )
102+ run_parser .add_argument (
103+ "--langchain-target" ,
104+ help = (
105+ "Run the scenario against a LangChain/LangGraph target loaded from "
106+ "a module:object import path."
107+ ),
108+ )
109+ run_parser .add_argument (
110+ "--langchain-goal-event" ,
111+ help = "Optional goal event id recorded in the LangChain/LangGraph trace." ,
112+ )
101113 run_parser .add_argument (
102114 "--openai-agent-max-turns" ,
103115 type = int ,
@@ -133,12 +145,14 @@ def main() -> int:
133145 args .python_target is not None ,
134146 args .openai_agent is not None ,
135147 args .mcp_target is not None ,
148+ args .langchain_target is not None ,
136149 ]
137150
138151 if sum (bool (mode ) for mode in selected_modes ) != 1 :
139152 parser .error (
140153 "'run' requires exactly one of --dry-run, --trace-file, "
141- "--live, --python-target, --openai-agent, or --mcp-target"
154+ "--live, --python-target, --openai-agent, --mcp-target, or "
155+ "--langchain-target"
142156 )
143157
144158 if args .live and not args .target_url :
@@ -150,6 +164,15 @@ def main() -> int:
150164 if args .openai_agent_max_turns is not None and args .openai_agent is None :
151165 parser .error ("--openai-agent-max-turns can only be used with --openai-agent" )
152166
167+ if args .langchain_goal_event is not None and args .langchain_target is None :
168+ parser .error ("--langchain-goal-event can only be used with --langchain-target" )
169+
170+ if (
171+ args .langchain_goal_event is not None
172+ and not args .langchain_goal_event .strip ()
173+ ):
174+ parser .error ("--langchain-goal-event must be a non-empty string" )
175+
153176 if (
154177 args .openai_agent_max_turns is not None
155178 and args .openai_agent_max_turns <= 0
@@ -199,6 +222,16 @@ def main() -> int:
199222 except AdapterError as exc :
200223 print (f"adapter error: { exc } " , file = sys .stderr )
201224 return 1
225+ elif args .langchain_target :
226+ try :
227+ result = run_scenario_with_langchain_target (
228+ scenario ,
229+ args .langchain_target ,
230+ goal_event_id = args .langchain_goal_event ,
231+ )
232+ except AdapterError as exc :
233+ print (f"adapter error: { exc } " , file = sys .stderr )
234+ return 1
202235 else :
203236 try :
204237 trace = load_trace (args .trace_file )
0 commit comments