mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-10 19:57:52 +02:00
feat(cli): emit unified AGENT_SERVER_CONFIG env var in Dockerfiles
Replace 8+ individual ENV lines (LANGGRAPH_STORE, LANGGRAPH_AUTH, LANGGRAPH_HTTP, LANGSERVE_GRAPHS, etc.) with a single AGENT_SERVER_CONFIG env var in generated Dockerfiles. Companion server PR: langchain-ai/langgraph-api#2826 Release Notes: - CLI now emits a single `AGENT_SERVER_CONFIG` environment variable in generated Dockerfiles instead of 8+ individual `LANGGRAPH_*` env vars. Requires langgraph-api >= 0.7.56. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
8fbdb14487
commit
c7760f1d4f
@@ -22,6 +22,24 @@ DEFAULT_IMAGE_DISTRO = "debian"
|
||||
_BUILD_TOOLS = ("pip", "setuptools", "wheel")
|
||||
|
||||
|
||||
def _build_server_config_env(config: Config) -> str:
|
||||
"""Build the AGENT_SERVER_CONFIG env var line from a validated config."""
|
||||
server_config: dict = {"graphs": config["graphs"]}
|
||||
for key in (
|
||||
"store",
|
||||
"auth",
|
||||
"encryption",
|
||||
"http",
|
||||
"webhooks",
|
||||
"checkpointer",
|
||||
"ui",
|
||||
"ui_config",
|
||||
):
|
||||
if (value := config.get(key)) is not None:
|
||||
server_config[key] = value
|
||||
return f"ENV AGENT_SERVER_CONFIG='{json.dumps(server_config)}'"
|
||||
|
||||
|
||||
def _get_pip_cleanup_lines(
|
||||
install_cmd: str,
|
||||
to_uninstall: tuple[str] | None,
|
||||
@@ -1006,36 +1024,7 @@ ADD {relpath} /deps/{name}
|
||||
)
|
||||
)
|
||||
|
||||
env_vars = []
|
||||
|
||||
if (store_config := config.get("store")) is not None:
|
||||
env_vars.append(f"ENV LANGGRAPH_STORE='{json.dumps(store_config)}'")
|
||||
|
||||
if (auth_config := config.get("auth")) is not None:
|
||||
env_vars.append(f"ENV LANGGRAPH_AUTH='{json.dumps(auth_config)}'")
|
||||
|
||||
if (encryption_config := config.get("encryption")) is not None:
|
||||
env_vars.append(f"ENV LANGGRAPH_ENCRYPTION='{json.dumps(encryption_config)}'")
|
||||
|
||||
if (http_config := config.get("http")) is not None:
|
||||
env_vars.append(f"ENV LANGGRAPH_HTTP='{json.dumps(http_config)}'")
|
||||
|
||||
# Inject webhooks configuration if provided
|
||||
if (webhooks_config := config.get("webhooks")) is not None:
|
||||
env_vars.append(f"ENV LANGGRAPH_WEBHOOKS='{json.dumps(webhooks_config)}'")
|
||||
|
||||
if (checkpointer_config := config.get("checkpointer")) is not None:
|
||||
env_vars.append(
|
||||
f"ENV LANGGRAPH_CHECKPOINTER='{json.dumps(checkpointer_config)}'"
|
||||
)
|
||||
|
||||
if (ui := config.get("ui")) is not None:
|
||||
env_vars.append(f"ENV LANGGRAPH_UI='{json.dumps(ui)}'")
|
||||
|
||||
if (ui_config := config.get("ui_config")) is not None:
|
||||
env_vars.append(f"ENV LANGGRAPH_UI_CONFIG='{json.dumps(ui_config)}'")
|
||||
|
||||
env_vars.append(f"ENV LANGSERVE_GRAPHS='{json.dumps(config['graphs'])}'")
|
||||
env_vars = [_build_server_config_env(config)]
|
||||
|
||||
js_inst_str: str = ""
|
||||
if (config.get("ui") or config.get("node_version")) and local_deps.working_dir:
|
||||
@@ -1137,36 +1126,7 @@ def node_config_to_docker(
|
||||
|
||||
image_str = docker_tag(config, base_image, api_version)
|
||||
|
||||
env_vars: list[str] = []
|
||||
|
||||
if (store_config := config.get("store")) is not None:
|
||||
env_vars.append(f"ENV LANGGRAPH_STORE='{json.dumps(store_config)}'")
|
||||
|
||||
if (auth_config := config.get("auth")) is not None:
|
||||
env_vars.append(f"ENV LANGGRAPH_AUTH='{json.dumps(auth_config)}'")
|
||||
|
||||
if (encryption_config := config.get("encryption")) is not None:
|
||||
env_vars.append(f"ENV LANGGRAPH_ENCRYPTION='{json.dumps(encryption_config)}'")
|
||||
|
||||
if (http_config := config.get("http")) is not None:
|
||||
env_vars.append(f"ENV LANGGRAPH_HTTP='{json.dumps(http_config)}'")
|
||||
|
||||
# Inject webhooks configuration if provided
|
||||
if (webhooks_config := config.get("webhooks")) is not None:
|
||||
env_vars.append(f"ENV LANGGRAPH_WEBHOOKS='{json.dumps(webhooks_config)}'")
|
||||
|
||||
if (checkpointer_config := config.get("checkpointer")) is not None:
|
||||
env_vars.append(
|
||||
f"ENV LANGGRAPH_CHECKPOINTER='{json.dumps(checkpointer_config)}'"
|
||||
)
|
||||
|
||||
if ui := config.get("ui"):
|
||||
env_vars.append(f"ENV LANGGRAPH_UI='{json.dumps(ui)}'")
|
||||
|
||||
if ui_config := config.get("ui_config"):
|
||||
env_vars.append(f"ENV LANGGRAPH_UI_CONFIG='{json.dumps(ui_config)}'")
|
||||
|
||||
env_vars.append(f"ENV LANGSERVE_GRAPHS='{json.dumps(config['graphs'])}'")
|
||||
env_vars: list[str] = [_build_server_config_env(config)]
|
||||
|
||||
# For monorepo support, we need to handle install and build commands differently
|
||||
if build_context:
|
||||
|
||||
@@ -713,9 +713,28 @@ class Config(TypedDict, total=False):
|
||||
"""
|
||||
|
||||
|
||||
class ServerConfig(TypedDict, total=False):
|
||||
"""Unified server configuration emitted as ``AGENT_SERVER_CONFIG``.
|
||||
|
||||
Mirrors the server-side ``ServerConfig`` but only contains fields
|
||||
relevant to the CLI's Dockerfile / docker-compose emission.
|
||||
"""
|
||||
|
||||
graphs: dict[str, str]
|
||||
store: StoreConfig | None
|
||||
auth: AuthConfig | None
|
||||
encryption: EncryptionConfig | None
|
||||
http: HttpConfig | None
|
||||
webhooks: WebhooksConfig | None
|
||||
checkpointer: CheckpointerConfig | None
|
||||
ui: dict[str, str] | None
|
||||
ui_config: dict | None
|
||||
|
||||
|
||||
__all__ = [
|
||||
"Config",
|
||||
"GraphDef",
|
||||
"ServerConfig",
|
||||
"StoreConfig",
|
||||
"CheckpointerConfig",
|
||||
"AuthConfig",
|
||||
|
||||
Reference in New Issue
Block a user