diff --git a/src/agentkit/server/app.py b/src/agentkit/server/app.py index 511dd0a..541e89c 100644 --- a/src/agentkit/server/app.py +++ b/src/agentkit/server/app.py @@ -351,10 +351,17 @@ def create_app( """ # Auto-load config from env var if not provided (uvicorn factory mode) if server_config is None: + from pathlib import Path as _P + config_path = os.environ.get("AGENTKIT_CONFIG_PATH") + if not config_path or not os.path.exists(config_path): + # Auto-discover agentkit.yaml in CWD + _cwd_yaml = _P.cwd() / "agentkit.yaml" + if _cwd_yaml.exists(): + config_path = str(_cwd_yaml) + if config_path and os.path.exists(config_path): # Load .env before parsing config (so ${ENV_VAR} substitutions work) - from pathlib import Path as _P _dotenv = _P(config_path).parent / ".env" if _dotenv.exists(): with open(_dotenv, encoding="utf-8") as _f: