MCPcopy Create free account
hub / github.com/langchain-ai/langgraph / compose

Function compose

libs/cli/langgraph_cli/docker.py:143–202  ·  view source on GitHub ↗
(
    capabilities: DockerCapabilities,
    *,
    port: int,
    debugger_port: Optional[int] = None,
    debugger_base_url: Optional[str] = None,
    # postgres://user:password@host:port/database?option=value
    postgres_uri: Optional[str] = None,
)

Source from the content-addressed store, hash-verified

141
142
143def compose(
144 capabilities: DockerCapabilities,
145 *,
146 port: int,
147 debugger_port: Optional[int] = None,
148 debugger_base_url: Optional[str] = None,
149 # postgres://user:password@host:port/database?option=value
150 postgres_uri: Optional[str] = None,
151) -> str:
152 if postgres_uri is None:
153 include_db = True
154 postgres_uri = DEFAULT_POSTGRES_URI
155 else:
156 include_db = False
157
158 db = DB.format() if include_db else ""
159 volumes = (
160 """volumes:
161 langgraph-data:
162 driver: local
163"""
164 if include_db
165 else ""
166 )
167 if db:
168 if capabilities.healthcheck_start_interval:
169 db += """
170 interval: 60s
171 start_interval: 1s"""
172 else:
173 db += """
174 interval: 5s"""
175
176 compose_str = f"""{volumes}services:
177{REDIS}
178{db}
179{debugger_compose(port=debugger_port, base_url=debugger_base_url)}
180 langgraph-api:
181 ports:
182 - "{port}:8000\"
183 depends_on:
184 langgraph-redis:
185 condition: service_healthy"""
186 if include_db:
187 compose_str += """
188 langgraph-postgres:
189 condition: service_healthy"""
190 compose_str += f"""
191 environment:
192 REDIS_URI: redis://langgraph-redis:6379
193 POSTGRES_URI: {postgres_uri}
194"""
195 if capabilities.healthcheck_start_interval:
196 compose_str += """ healthcheck:
197 test: python /api/healthcheck.py
198 interval: 60s
199 start_interval: 1s
200 start_period: 10s"""

Calls 1

debugger_composeFunction · 0.85