Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mcp-server-langgraph.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Automate your LangGraph Platform deployments with continuous integration and deployment pipelines. Deploy on every commit, with automated testing and rollback capabilities.
Automated Deployments: Push to main → CI/CD tests → Auto-deploy to production

GitHub Actions

Quick Setup

1

Add LangSmith API Key

Go to GitHub repo → Settings → Secrets → New repository secretName: LANGCHAIN_API_KEY Value: Your LangSmith API key from smith.langchain.com/settings
2

Create Workflow File

mkdir -p .github/workflows
cp .github/workflows/deploy-langgraph-platform.yml .github/workflows/
3

Push to GitHub

git add .github/workflows/deploy-langgraph-platform.yml
git commit -m "Add LangGraph Platform CI/CD"
git push

Full Workflow

.github/workflows/deploy-langgraph-platform.yml
name: Deploy to LangGraph Platform

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
  workflow_dispatch:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Install dependencies
        run: |
          uv sync

      - name: Run tests
        run: pytest tests/ -v

  deploy-staging:
    needs: test
    if: github.event_name == 'push' && github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    environment: staging
    steps:
      - uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Install LangGraph CLI
        run: uv tool install langgraph-cli

      - name: Deploy to Staging
        env:
          LANGCHAIN_API_KEY: ${{ secrets.LANGCHAIN_API_KEY }}
        run: |
          langgraph deploy staging-mcp-server-langgraph --tag staging

      - name: Smoke Test Staging
        run: |
          langgraph deployment invoke staging-mcp-server-langgraph \
            --input '{"messages": [{"role": "user", "content": "test"}]}'

  deploy-production:
    needs: deploy-staging
    if: github.event_name == 'push' && github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    environment: production
    steps:
      - uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Install LangGraph CLI
        run: uv tool install langgraph-cli

      - name: Deploy to Production
        env:
          LANGCHAIN_API_KEY: ${{ secrets.LANGCHAIN_API_KEY }}
        run: |
          langgraph deploy mcp-server-langgraph-prod \
            --tag production \
            --tag "$(git rev-parse --short HEAD)"

      - name: Verify Deployment
        run: |
          langgraph deployment get mcp-server-langgraph-prod

      - name: Smoke Test Production
        run: |
          langgraph deployment invoke mcp-server-langgraph-prod \
            --input '{"messages": [{"role": "user", "content": "Hello"}]}'

Environment Protection Rules

Set up deployment approvals in GitHub:
1

Go to Repository Settings

Settings → Environments → New environment
2

Create 'production' Environment

  • Name: production
  • Enable “Required reviewers”
  • Add reviewers (team leads)
  • Set deployment branch: main only
3

Create 'staging' Environment

  • Name: staging
  • No approvals needed
  • Auto-deploy on push to main

GitLab CI/CD

.gitlab-ci.yml
stages:
  - test
  - deploy-staging
  - deploy-production

variables:
  PYTHON_VERSION: "3.11"

test:
  stage: test
  image: python:${PYTHON_VERSION}
  script:
    - curl -LsSf https://astral.sh/uv/install.sh | sh
    - uv sync
    - uv run pytest tests/ -v

deploy-staging:
  stage: deploy-staging
  image: python:${PYTHON_VERSION}
  environment:
    name: staging
    url: https://staging-mcp-server-langgraph.langchain.com
  script:
    - curl -LsSf https://astral.sh/uv/install.sh | sh
    - uv tool install langgraph-cli
    - langgraph deploy staging-mcp-server-langgraph --tag staging
    - |
      langgraph deployment invoke staging-mcp-server-langgraph \
        --input '{"messages": [{"role": "user", "content": "test"}]}'
  only:
    - main

deploy-production:
  stage: deploy-production
  image: python:${PYTHON_VERSION}
  environment:
    name: production
    url: https://mcp-server-langgraph-prod.langchain.com
  when: manual
  script:
    - curl -LsSf https://astral.sh/uv/install.sh | sh
    - uv tool install langgraph-cli
    - langgraph deploy mcp-server-langgraph-prod --tag production --tag "$CI_COMMIT_SHORT_SHA"
    - langgraph deployment get mcp-server-langgraph-prod
  only:
    - main

CircleCI

.circleci/config.yml
version: 2.1

orbs:
  python: circleci/python@2.1.1

jobs:
  test:
    docker:
      - image: cimg/python:3.12
    steps:
      - checkout
      - python/install-packages:
          pkg-manager: pip
      - run:
          name: Run tests
          command: pytest tests/ -v

  deploy-staging:
    docker:
      - image: cimg/python:3.12
    steps:
      - checkout
      - run:
          name: Install LangGraph CLI
          command: uv tool install langgraph-cli
      - run:
          name: Deploy to Staging
          command: |
            langgraph deploy staging-mcp-server-langgraph --tag staging
      - run:
          name: Smoke Test
          command: |
            langgraph deployment invoke staging-mcp-server-langgraph \
              --input '{"messages": [{"role": "user", "content": "test"}]}'

  deploy-production:
    docker:
      - image: cimg/python:3.12
    steps:
      - checkout
      - run:
          name: Install LangGraph CLI
          command: uv tool install langgraph-cli
      - run:
          name: Deploy to Production
          command: |
            langgraph deploy mcp-server-langgraph-prod \
              --tag production \
              --tag "${CIRCLE_SHA1:0:7}"

workflows:
  test-and-deploy:
    jobs:
      - test
      - deploy-staging:
          requires:
            - test
          filters:
            branches:
              only: main
      - hold-production:
          type: approval
          requires:
            - deploy-staging
      - deploy-production:
          requires:
            - hold-production

Best Practices

jobs:
  test:
    # Run unit tests, integration tests

  deploy:
    needs: test  # Only deploy if tests pass
deploy-staging:
  # Deploy to staging first
  # Run smoke tests

deploy-production:
  needs: deploy-staging  # Only deploy to prod if staging succeeds
# Tag with git commit SHA
langgraph deploy my-agent-prod --tag "$(git rev-parse --short HEAD)"

# Tag with semantic version
langgraph deploy my-agent-prod --tag "v1.2.3"

# Tag with timestamp
langgraph deploy my-agent-prod --tag "deploy-$(date +%Y%m%d-%H%M%S)"
Use GitHub Environments or GitLab’s manual approval:
deploy-production:
  environment: production  # Requires approval
  when: manual
# After deployment, verify it works
langgraph deployment invoke my-agent-prod \
  --input '{"messages": [{"role": "user", "content": "health check"}]}' \
  --timeout 30
    - name: Notify Slack
      if: success()
      uses: slackapi/slack-github-action@v1
      with:
        payload: |
          {
            "text": "✅ Deployed to production: ${{ github.sha }}"
          }
      env:
        SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

Rollback Strategy

Automatic Rollback on Failure

- name: Deploy to Production
  id: deploy
  run: langgraph deploy my-agent-prod --tag production

- name: Smoke Test
  id: test
  run: |
    langgraph deployment invoke my-agent-prod \
      --input '{"messages": [{"role": "user", "content": "test"}]}'

- name: Rollback on Failure
  if: failure() && steps.deploy.outcome == 'success'
  run: |
    # Get previous revision
    PREV_REVISION=$(langgraph deployment list | grep my-agent-prod | awk 'NR==2 {print $2}')
    # Rollback
    langgraph deployment rollback my-agent-prod --revision $PREV_REVISION

Manual Rollback

## List revisions
langgraph deployment list my-agent-prod

## Rollback to specific revision
langgraph deployment rollback my-agent-prod --revision 42

## Or rollback to previous
langgraph deployment rollback my-agent-prod

Multi-Environment Strategy

Trigger: Every push to develop branch
NOTE: Automatic deploys only run when the repository variable ENABLE_DEV_AUTODEPLOY is set to true. This keeps CI from waiting on environment approvals by default.
deploy-dev:
  if: github.ref == 'refs/heads/develop'
  run: langgraph deploy my-agent-dev --tag development

Monitoring Deployments

View deployment status:
## Get deployment info
langgraph deployment get my-agent-prod

## Stream logs
langgraph deployment logs my-agent-prod --follow

## View in LangSmith
## https://smith.langchain.com → Select project → View traces

Troubleshooting

Symptom: 401 UnauthorizedSolution: Verify LANGCHAIN_API_KEY secret is set correctly in CI/CD platform.
Symptom: Deployment takes too longSolution:
  • Optimize dependencies in langgraph/requirements.txt
  • Reduce Docker image size
  • Check network connectivity
Symptom: Test invocation returns errorSolution:
  • Check deployment logs: langgraph deployment logs
  • Verify secrets are set
  • Test locally first with langgraph dev

Next Steps

Quickstart

Deploy your first agent

Monitoring

Monitor deployments

Secrets

Manage secrets in CI/CD

Configuration

Configure deployments

CI/CD Ready! Your LangGraph Platform deployments are now automated with testing, staging, and production workflows.