File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -43,13 +43,23 @@ def find_binary(cls) -> Path | None:
4343 """
4444 Find and return the path to the agent binary.
4545
46+ Checks the EXPLAIN_{AGENT}_PATH environment variable first (e.g.
47+ EXPLAIN_CLAUDE_PATH, EXPLAIN_AMP_PATH), before falling back to a PATH lookup.
48+
4649 Returns:
4750 Path to the agent binary, or None if not found
51+
52+ Raises:
53+ FileNotFoundError: If the EXPLAIN_{AGENT}_PATH environment variable is set but the path
54+ could not be found
4855 """
49- if loc := shutil .which (cls .program_name ):
50- return Path (loc )
51- else :
52- return None
56+ env_var = f"EXPLAIN_{ cls .name .upper ()} _PATH"
57+ program = os .environ .get (env_var ) or cls .program_name
58+ if loc := shutil .which (program ):
59+ return Path (loc ).absolute ()
60+ if os .environ .get (env_var ):
61+ raise FileNotFoundError (f"{ env_var } is set to { program !r} but it could not be found." )
62+ return None
5363
5464 @abstractmethod
5565 async def ask (self , question : str , port : int , tools : list [str ]) -> str :
You can’t perform that action at this time.
0 commit comments