feat(cli): Update langgraph deploy command to use agent_id and environment args (#9055)

- Accept agent_id and environment args for `lanngraph deploy`
  - Validate both arguments present or none
- If agent arguments present, make sure deployment_id and name are not
present
This commit is contained in:
Sreekara Yachamaneni
2026-09-22 16:28:36 -04:00
committed by GitHub
parent 1afaca35a0
commit 1211af45b1
3 changed files with 244 additions and 30 deletions
+19 -4
View File
@@ -156,27 +156,42 @@ class HostBackendClient:
def create_deployment(
self,
*,
name: str,
name: str | None,
source: SourceName,
source_config: dict[str, object],
source_revision_config: dict[str, object],
secrets: list[dict[str, str]] | None = None,
agent: dict[str, str] | None = None,
) -> dict[str, Any]:
payload: dict[str, Any] = {
"name": name,
"source": source,
"source_config": source_config,
"source_revision_config": source_revision_config,
}
if agent is not None:
payload["agent"] = agent
else:
payload["name"] = name
if secrets is not None:
payload["secrets"] = secrets
return self._request("POST", "/v2/deployments", payload)
def list_deployments(self, name_contains: str = "") -> dict[str, Any]:
def list_deployments(
self,
name_contains: str = "",
*,
agent_id: str | None = None,
agent_environment: str | None = None,
) -> dict[str, Any]:
params = {"name_contains": name_contains}
if agent_id is not None:
params["agent_id"] = agent_id
if agent_environment is not None:
params["agent_environment"] = agent_environment
return self._request(
"GET",
"/v2/deployments",
params={"name_contains": name_contains},
params=params,
)
def get_deployment(self, deployment_id: str) -> dict[str, Any]: