Skip to content

A programming framework for agentic AI

Fix exception cause in agent_builder.py (#1007)

Ram Rachum913b5f2fb150
diff --git a/autogen/agentchat/contrib/agent_builder.py b/autogen/agentchat/contrib/agent_builder.py
index 91386519d..d16e04307 100644
--- a/autogen/agentchat/contrib/agent_builder.py
+++ b/autogen/agentchat/contrib/agent_builder.py
@@ -446,7 +446,7 @@ class AgentBuilder:
try:
with open(filepath) as f:
cached_configs = json.load(f)
- except FileNotFoundError:
- raise FileNotFoundError(f"{filepath} does not exist.")
+ except FileNotFoundError as e:
+ raise FileNotFoundError(f"{filepath} does not exist.") from e
_config_check(cached_configs)
return self.build(cached_configs=cached_configs, **kwargs)