Skip to content

Commit 5c01863

Browse files
CopilotOhYee
andcommitted
fix(core): add 'ag_ui' to optional dependency error check
Add "ag_ui" to the error message checking logic in __getattr__ to properly handle import errors when ag-ui-protocol is not installed. This ensures users get helpful error messages when trying to use AGUIProtocolHandler or other AG-UI related components without the server optional dependencies installed. Addresses feedback from PR #23 review comment. Co-authored-by: OhYee <[email protected]>
1 parent ca3ca9b commit 5c01863

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

agentrun/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def __getattr__(name: str):
303303
return getattr(server, name)
304304
except ImportError as e:
305305
# 检查是否是缺少可选依赖导致的错误
306-
if "fastapi" in str(e) or "uvicorn" in str(e):
306+
if "fastapi" in str(e) or "uvicorn" in str(e) or "ag_ui" in str(e):
307307
raise ImportError(
308308
f"'{name}' requires the 'server' optional dependencies. "
309309
"Install with: pip install agentrun-sdk[server]\n"

0 commit comments

Comments
 (0)