Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions agentflow_cli/src/app/loader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import importlib
import inspect
import logging
import os
from pathlib import Path

from agentflow.checkpointer import BaseCheckpointer
from agentflow.graph import CompiledGraph
Expand Down Expand Up @@ -197,6 +199,24 @@ async def attach_all_modules(
if auth_config:
method = auth_config.get("method", None)
path = auth_config.get("path", None)
if not path or not method:
raise ValueError("Both 'method' and 'path' must be specified in auth_config.")

# Extract file path before the ':' for existence check
module_or_path = path.split(":", 1)[0] if ":" in path else path

# Simple handling: if it appears to be a filesystem path, use it; otherwise
# convert dotted module path to a file path like src/auth/custom_auth.py
if os.path.sep in module_or_path or module_or_path.endswith(".py"):
file_path = Path(module_or_path)
elif "." in module_or_path and os.path.sep not in module_or_path:
file_path = Path(module_or_path.replace(".", os.path.sep) + ".py")
else:
file_path = Path(module_or_path)

if not file_path.exists():
raise ValueError(f"Custom auth path does not exist: {module_or_path}")

if method == "custom":
auth_backend = load_auth(
path,
Expand Down