mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
091eb86f16
Rewrite the langgraph-js agent to use `createAgent` from `langchain` (matching langgraph-python) with `copilotkitMiddleware` and `stateStreamingMiddleware` from `@copilotkit/sdk-js/langgraph-middlewares`. Tools now use `ToolRuntime` for state and tool-call-id access. System prompt inlined in `agent.ts`; drop the file-based `PROMPT.md`. Replace the legacy single-stage Dockerfile with a Node-only two-stage build that mirrors the langgraph-python Dockerfile (frontend build → runner, HttpAgent route override for Docker, Turbopack→webpack). Add JS-specific `entrypoint.sh` (launches `@langchain/langgraph-cli dev` + Next.js standalone) and `docker-compose.test.yml` (wget healthcheck for the alpine-based agent image, STARTER=langgraph-js default). Both added to the instance's `allowedDivergence` in the parity manifest. Rewrite the README to drop Python/uv prerequisites and list the correct TypeScript tool paths.
29 lines
694 B
Bash
Executable File
29 lines
694 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
echo "[entrypoint] Starting: langgraph-js starter"
|
|
|
|
if [ -z "$OPENAI_API_KEY" ]; then
|
|
echo "[entrypoint] WARNING: OPENAI_API_KEY not set!"
|
|
else
|
|
echo "[entrypoint] OPENAI_API_KEY: set"
|
|
fi
|
|
|
|
# Start agent via LangGraph CLI
|
|
echo "[entrypoint] Starting agent on port 8123..."
|
|
cd /app/agent
|
|
AGENT_PORT=8123 npx --yes @langchain/langgraph-cli dev \
|
|
--host 0.0.0.0 --port 8123 --no-browser 2>&1 &
|
|
AGENT_PID=$!
|
|
cd /app
|
|
|
|
sleep 3
|
|
|
|
# Start Next.js standalone
|
|
echo "[entrypoint] Starting Next.js on port ${PORT:-3000}..."
|
|
HOSTNAME=0.0.0.0 PORT=${PORT:-3000} node server.js 2>&1 &
|
|
NEXT_PID=$!
|
|
|
|
echo "[entrypoint] Agent=$AGENT_PID Next=$NEXT_PID"
|
|
wait -n $AGENT_PID $NEXT_PID
|
|
exit $? |