my langgraph.json:
{
"node_version": "20",
"dependencies": ["."],
"graphs": {
"agent": "./chatbi_agent.ts:deepResearcher"
},
"env": ".env",
"http": {
"app": "./app.ts:app"
}
}
The custom routes in app.ts work well in my local pc. I try to apply it in the langgraph-api server using docker:
FROM langchain/langgraphjs-api:20
ADD . /deps/chatbi-agent-js-v2
ENV LANGSERVE_GRAPHS='{"agent":"./chatbi_agent.ts:deepResearcher"}'
WORKDIR /deps/chatbi-agent-js-v2
RUN pnpm config set registry https://registry.npmmirror.com
ENV CI=true
RUN pnpm i --frozen-lockfile
RUN (test ! -f /api/langgraph_api/js/build.mts && echo "Prebuild script not found, skipping") || tsx /api/langgraph_api/js/build.mts
And the docker-compose.yaml:
volumes:
langgraph-data:
driver: local
services:
langgraph-redis:
image: redis:6
healthcheck:
test: redis-cli ping
interval: 5s
timeout: 1s
retries: 5
langgraph-postgres:
image: postgres:16
ports:
- "5433:5432"
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
volumes:
- langgraph-data:/var/lib/postgresql/data
healthcheck:
test: pg_isready -U postgres
start_period: 10s
timeout: 1s
retries: 5
interval: 5s
langgraph-api:
image: chatbi-agent:latest
ports:
- "8080:8000"
depends_on:
langgraph-redis:
condition: service_healthy
langgraph-postgres:
condition: service_healthy
env_file:
- .env
environment:
REDIS_URI: redis://langgraph-redis:6379
LANGSMITH_API_KEY: lsv2_pt_xxx
POSTGRES_URI: postgres://postgres:postgres@langgraph-postgres:5432/postgres?sslmode=disable
# frontend:
# image: agent-frontend:latest
# ports:
# - "3000:3000"
# env_file:
# - .env
And the custom route return ‘404’ when requesting ‘/api-route’