diff --git a/libs/cli/langgraph_cli/config.py b/libs/cli/langgraph_cli/config.py index 2b7e4bbcc..5082bb017 100644 --- a/libs/cli/langgraph_cli/config.py +++ b/libs/cli/langgraph_cli/config.py @@ -334,6 +334,10 @@ class Config(TypedDict, total=False): and how cross-origin requests are handled. """ + ui: Optional[dict[str, str]] + """Optional. Named definitions of UI components emitted by the agent, each pointing to a JS/TS file. + """ + def _parse_version(version_str: str) -> tuple[int, int]: """Parse a version string into a tuple of (major, minor).""" @@ -369,6 +373,7 @@ def validate_config(config: Config) -> Config: "store": config.get("store"), "auth": config.get("auth"), "http": config.get("http"), + "ui": config.get("ui"), } if config.get("node_version") else { @@ -381,6 +386,7 @@ def validate_config(config: Config) -> Config: "store": config.get("store"), "auth": config.get("auth"), "http": config.get("http"), + "ui": config.get("ui"), } ) @@ -1029,6 +1035,7 @@ ADD . {faux_path} RUN cd {faux_path} && {install_cmd} {env_additional_config} ENV LANGSERVE_GRAPHS='{json.dumps(config["graphs"])}' +{f"ENV LANGGRAPH_UI='{json.dumps(config['ui'])}'" if config.get("ui") else ""} WORKDIR {faux_path} diff --git a/libs/cli/pyproject.toml b/libs/cli/pyproject.toml index 8fb5bf4aa..1bb7171d8 100644 --- a/libs/cli/pyproject.toml +++ b/libs/cli/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langgraph-cli" -version = "0.1.74" +version = "0.1.75" description = "CLI for interacting with LangGraph API" authors = [] license = "MIT" diff --git a/libs/cli/schemas/schema.json b/libs/cli/schemas/schema.json index 8b674be52..37186cd95 100644 --- a/libs/cli/schemas/schema.json +++ b/libs/cli/schemas/schema.json @@ -96,6 +96,20 @@ } ], "description": "Optional. Configuration for the built-in long-term memory store, including semantic search indexing.\n\nIf omitted, no vector index is set up (the object store will still be present, however).\n" + }, + "ui": { + "anyOf": [ + { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + { + "type": "null" + } + ], + "description": "Optional. Named definitions of UI components emitted by the agent, each pointing to a JS/TS file.\n" } }, "required": [ @@ -187,6 +201,20 @@ } ], "description": "Optional. Configuration for the built-in long-term memory store, including semantic search indexing.\n\nIf omitted, no vector index is set up (the object store will still be present, however).\n" + }, + "ui": { + "anyOf": [ + { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + { + "type": "null" + } + ], + "description": "Optional. Named definitions of UI components emitted by the agent, each pointing to a JS/TS file.\n" } }, "required": [ diff --git a/libs/cli/schemas/schema.v0.json b/libs/cli/schemas/schema.v0.json index 8b674be52..37186cd95 100644 --- a/libs/cli/schemas/schema.v0.json +++ b/libs/cli/schemas/schema.v0.json @@ -96,6 +96,20 @@ } ], "description": "Optional. Configuration for the built-in long-term memory store, including semantic search indexing.\n\nIf omitted, no vector index is set up (the object store will still be present, however).\n" + }, + "ui": { + "anyOf": [ + { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + { + "type": "null" + } + ], + "description": "Optional. Named definitions of UI components emitted by the agent, each pointing to a JS/TS file.\n" } }, "required": [ @@ -187,6 +201,20 @@ } ], "description": "Optional. Configuration for the built-in long-term memory store, including semantic search indexing.\n\nIf omitted, no vector index is set up (the object store will still be present, however).\n" + }, + "ui": { + "anyOf": [ + { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + { + "type": "null" + } + ], + "description": "Optional. Named definitions of UI components emitted by the agent, each pointing to a JS/TS file.\n" } }, "required": [ diff --git a/libs/cli/tests/unit_tests/test_config.py b/libs/cli/tests/unit_tests/test_config.py index 95e20033e..397fca031 100644 --- a/libs/cli/tests/unit_tests/test_config.py +++ b/libs/cli/tests/unit_tests/test_config.py @@ -33,6 +33,7 @@ def test_validate_config(): "store": None, "auth": None, "http": None, + "ui": None, **expected_config, } actual_config = validate_config(expected_config) @@ -52,6 +53,7 @@ def test_validate_config(): "store": None, "auth": None, "http": None, + "ui": None, } actual_config = validate_config(expected_config) assert actual_config == expected_config @@ -467,6 +469,7 @@ def test_config_to_docker_nodejs(): "node_version": "20", "graphs": graphs, "dockerfile_lines": ["ARG meow", "ARG foo"], + "ui": {"agent": "./graphs/agent.ui.jsx"}, } ), "langchain/langgraphjs-api", @@ -477,6 +480,7 @@ ARG foo ADD . /deps/unit_tests RUN cd /deps/unit_tests && npm i ENV LANGSERVE_GRAPHS='{"agent": "./graphs/agent.js:graph"}' +ENV LANGGRAPH_UI='{"agent": "./graphs/agent.ui.jsx"}' WORKDIR /deps/unit_tests RUN (test ! -f /api/langgraph_api/js/build.mts && echo "Prebuild script not found, skipping") || tsx /api/langgraph_api/js/build.mts"""