mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-25 02:55:07 +02:00
fix(cli): defer parent agent env validation
This commit is contained in:
@@ -12,6 +12,7 @@ from collections.abc import Callable, Mapping, Sequence
|
||||
from contextlib import contextmanager
|
||||
from dataclasses import asdict, dataclass, field
|
||||
from datetime import datetime, timezone
|
||||
from functools import partial
|
||||
from typing import Protocol, TypeVar
|
||||
|
||||
import click
|
||||
@@ -1696,7 +1697,8 @@ OPT_AGENT_ID = click.option(
|
||||
help="Logical agent ID (requires agent mode enabled for the tenant).",
|
||||
)
|
||||
|
||||
OPT_AGENT_ENVIRONMENT = click.option(
|
||||
OPT_AGENT_ENVIRONMENT = partial(
|
||||
click.option,
|
||||
"--agent-environment",
|
||||
"environment",
|
||||
envvar="LANGSMITH_AGENT_ENVIRONMENT",
|
||||
@@ -1804,7 +1806,9 @@ def _deploy_base_options(
|
||||
OPT_HOST_API_KEY,
|
||||
OPT_HOST_DEPLOYMENT_NAME,
|
||||
OPT_AGENT_ID,
|
||||
OPT_AGENT_ENVIRONMENT,
|
||||
OPT_AGENT_ENVIRONMENT()
|
||||
if include_docker_args
|
||||
else OPT_AGENT_ENVIRONMENT(type=str),
|
||||
click.option(
|
||||
"--deployment-id",
|
||||
help=(
|
||||
@@ -1936,6 +1940,12 @@ def deploy(ctx: click.Context, **_: object):
|
||||
# otherwise, we return None here and click will proceed to actually run the subcommand (list or delete)
|
||||
if ctx.invoked_subcommand is not None:
|
||||
return
|
||||
environment_param = next(
|
||||
param for param in _deploy_cmd.params if param.name == "environment"
|
||||
)
|
||||
ctx.params["environment"] = environment_param.type_cast_value(
|
||||
ctx, ctx.params["environment"]
|
||||
)
|
||||
if (
|
||||
ctx.params.get("agent_id") is not None
|
||||
or ctx.params.get("environment") is not None
|
||||
@@ -2131,7 +2141,7 @@ def _deploy_cmd(
|
||||
@OPT_HOST_API_KEY
|
||||
@OPT_HOST_URL
|
||||
@OPT_AGENT_ID
|
||||
@OPT_AGENT_ENVIRONMENT
|
||||
@OPT_AGENT_ENVIRONMENT()
|
||||
@click.option(
|
||||
"--name-contains",
|
||||
default="",
|
||||
|
||||
Reference in New Issue
Block a user