build agent correctly
This commit is contained in:
@@ -22,12 +22,15 @@ jobs:
|
|||||||
username: ${{ gitea.actor }}
|
username: ${{ gitea.actor }}
|
||||||
password: ${{ secrets.ACTIONS_PUSH_TOKEN }}
|
password: ${{ secrets.ACTIONS_PUSH_TOKEN }}
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Install uv
|
||||||
uses: docker/setup-buildx-action@v3
|
run: |
|
||||||
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build with langgraph
|
||||||
uses: docker/build-push-action@v6
|
working-directory: ./web/agent
|
||||||
with:
|
run: |
|
||||||
context: ./web/agent
|
uv run langgraph build -t git.seaturtle.pw/cavepedia/cavepediav2-agent:latest
|
||||||
push: true
|
|
||||||
tags: git.seaturtle.pw/cavepedia/cavepediav2-agent:latest
|
- name: Push image
|
||||||
|
run: docker push git.seaturtle.pw/cavepedia/cavepediav2-agent:latest
|
||||||
|
|||||||
@@ -61,12 +61,12 @@ docker build -t cavepediav2-agent .
|
|||||||
|
|
||||||
### Running in production
|
### Running in production
|
||||||
|
|
||||||
The agent requires PostgreSQL and Redis for persistence and pub/sub:
|
The agent requires PostgreSQL and Valkey for persistence and pub/sub:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run \
|
docker run \
|
||||||
-p 8123:8000 \
|
-p 8123:8000 \
|
||||||
-e REDIS_URI="redis://redis:6379" \
|
-e REDIS_URI="redis://valkey:6379" \
|
||||||
-e DATABASE_URI="postgres://user:pass@postgres:5432/langgraph" \
|
-e DATABASE_URI="postgres://user:pass@postgres:5432/langgraph" \
|
||||||
-e GOOGLE_API_KEY="your-key" \
|
-e GOOGLE_API_KEY="your-key" \
|
||||||
-e LANGSMITH_API_KEY="your-key" \
|
-e LANGSMITH_API_KEY="your-key" \
|
||||||
@@ -77,8 +77,8 @@ Or use Docker Compose with the required services:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
services:
|
services:
|
||||||
redis:
|
valkey:
|
||||||
image: redis:7
|
image: valkey/valkey:9
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:16
|
image: postgres:16
|
||||||
@@ -92,11 +92,11 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "8123:8000"
|
- "8123:8000"
|
||||||
environment:
|
environment:
|
||||||
REDIS_URI: redis://redis:6379
|
REDIS_URI: redis://valkey:6379
|
||||||
DATABASE_URI: postgres://langgraph:langgraph@postgres:5432/langgraph
|
DATABASE_URI: postgres://langgraph:langgraph@postgres:5432/langgraph
|
||||||
GOOGLE_API_KEY: ${GOOGLE_API_KEY}
|
GOOGLE_API_KEY: ${GOOGLE_API_KEY}
|
||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- valkey
|
||||||
- postgres
|
- postgres
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -104,6 +104,59 @@ services:
|
|||||||
|
|
||||||
The agent image is automatically built and pushed to `git.seaturtle.pw/cavepedia/cavepediav2-agent:latest` on push to `main` via Gitea Actions.
|
The agent image is automatically built and pushed to `git.seaturtle.pw/cavepedia/cavepediav2-agent:latest` on push to `main` via Gitea Actions.
|
||||||
|
|
||||||
|
## Web Deployment
|
||||||
|
|
||||||
|
### Environment Variables
|
||||||
|
|
||||||
|
| Variable | Required | Default | Description |
|
||||||
|
|----------|----------|---------|-------------|
|
||||||
|
| `LANGGRAPH_DEPLOYMENT_URL` | Yes | `http://localhost:8123` | URL to the LangGraph agent |
|
||||||
|
| `AUTH0_SECRET` | Yes | - | Session encryption key (`openssl rand -hex 32`) |
|
||||||
|
| `AUTH0_DOMAIN` | Yes | - | Auth0 tenant domain |
|
||||||
|
| `AUTH0_CLIENT_ID` | Yes | - | Auth0 application client ID |
|
||||||
|
| `AUTH0_CLIENT_SECRET` | Yes | - | Auth0 application client secret |
|
||||||
|
| `APP_BASE_URL` | Yes | - | Public URL of the app |
|
||||||
|
| `LANGSMITH_API_KEY` | No | - | LangSmith API key for tracing |
|
||||||
|
|
||||||
|
### Docker Compose (Full Stack)
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
image: git.seaturtle.pw/cavepedia/cavepediav2-web:latest
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
environment:
|
||||||
|
LANGGRAPH_DEPLOYMENT_URL: http://agent:8000
|
||||||
|
AUTH0_SECRET: ${AUTH0_SECRET}
|
||||||
|
AUTH0_DOMAIN: ${AUTH0_DOMAIN}
|
||||||
|
AUTH0_CLIENT_ID: ${AUTH0_CLIENT_ID}
|
||||||
|
AUTH0_CLIENT_SECRET: ${AUTH0_CLIENT_SECRET}
|
||||||
|
APP_BASE_URL: ${APP_BASE_URL}
|
||||||
|
depends_on:
|
||||||
|
- agent
|
||||||
|
|
||||||
|
agent:
|
||||||
|
image: git.seaturtle.pw/cavepedia/cavepediav2-agent:latest
|
||||||
|
environment:
|
||||||
|
REDIS_URI: redis://valkey:6379
|
||||||
|
DATABASE_URI: postgres://langgraph:langgraph@postgres:5432/langgraph
|
||||||
|
GOOGLE_API_KEY: ${GOOGLE_API_KEY}
|
||||||
|
depends_on:
|
||||||
|
- valkey
|
||||||
|
- postgres
|
||||||
|
|
||||||
|
valkey:
|
||||||
|
image: valkey/valkey:9
|
||||||
|
|
||||||
|
postgres:
|
||||||
|
image: postgres:16
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: langgraph
|
||||||
|
POSTGRES_USER: langgraph
|
||||||
|
POSTGRES_PASSWORD: langgraph
|
||||||
|
```
|
||||||
|
|
||||||
## Available Scripts
|
## Available Scripts
|
||||||
|
|
||||||
- `dev` - Start both UI and agent servers
|
- `dev` - Start both UI and agent servers
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
|
|
||||||
FROM python:3.13-slim
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Install uv for fast dependency management
|
|
||||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
|
||||||
|
|
||||||
# Copy dependency files
|
|
||||||
COPY pyproject.toml uv.lock ./
|
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
RUN uv sync --frozen --no-dev --no-install-project
|
|
||||||
|
|
||||||
# Copy application code
|
|
||||||
COPY main.py langgraph.json ./
|
|
||||||
|
|
||||||
# LangGraph API server port
|
|
||||||
EXPOSE 8000
|
|
||||||
|
|
||||||
# Run LangGraph server
|
|
||||||
CMD ["uv", "run", "langgraph", "up", "--host", "0.0.0.0", "--port", "8000"]
|
|
||||||
@@ -1,10 +1,7 @@
|
|||||||
{
|
{
|
||||||
"python_version": "3.12",
|
"python_version": "3.13",
|
||||||
"dockerfile_lines": [],
|
|
||||||
"dependencies": ["."],
|
"dependencies": ["."],
|
||||||
"package_manager": "uv",
|
|
||||||
"graphs": {
|
"graphs": {
|
||||||
"vpi_1000": "./main.py:graph"
|
"vpi_1000": "./main.py:graph"
|
||||||
},
|
}
|
||||||
"env": ".env"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ export const POST = async (req: NextRequest) => {
|
|||||||
// 2. Create the CopilotRuntime instance with Auth0 configuration
|
// 2. Create the CopilotRuntime instance with Auth0 configuration
|
||||||
const runtime = new CopilotRuntime({
|
const runtime = new CopilotRuntime({
|
||||||
agents: {
|
agents: {
|
||||||
"sample_agent": new LangGraphAgent({
|
"vpi_1000": new LangGraphAgent({
|
||||||
deploymentUrl: process.env.LANGGRAPH_DEPLOYMENT_URL || "http://localhost:8123",
|
deploymentUrl: process.env.LANGGRAPH_DEPLOYMENT_URL || "http://localhost:8123",
|
||||||
graphId: "sample_agent",
|
graphId: "vpi_1000",
|
||||||
langsmithApiKey: process.env.LANGSMITH_API_KEY || "",
|
langsmithApiKey: process.env.LANGSMITH_API_KEY || "",
|
||||||
assistantConfig: {
|
assistantConfig: {
|
||||||
context: {
|
context: {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export default function RootLayout({
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<body className={"antialiased"}>
|
<body className={"antialiased"}>
|
||||||
<Auth0Provider>
|
<Auth0Provider>
|
||||||
<CopilotKit runtimeUrl="/api/copilotkit" agent="sample_agent">
|
<CopilotKit runtimeUrl="/api/copilotkit" agent="vpi_1000">
|
||||||
{children}
|
{children}
|
||||||
</CopilotKit>
|
</CopilotKit>
|
||||||
</Auth0Provider>
|
</Auth0Provider>
|
||||||
|
|||||||
Reference in New Issue
Block a user