Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

First draft of PR for allowing provider tests

Kian Jones75efd2068bd5
diff --git a/.github/workflows/send-message-integration-tests.yaml b/.github/workflows/send-message-integration-tests.yaml
new file mode 100644
index 000000000..5ac62c021
--- /dev/null
+++ b/.github/workflows/send-message-integration-tests.yaml
@@ -0,0 +1,127 @@
+name: Send Message SDK Tests
+on:
+ pull_request_target:
+ # branches: [main] # TODO: uncomment before merge
+ types: [labeled]
+ paths:
+ - 'letta/schemas/**'
+
+jobs:
+ send-messages:
+ # Only run when the "safe to test" label is applied
+ if: contains(github.event.pull_request.labels.*.name, 'safe to test')
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
+ strategy:
+ fail-fast: false
+ matrix:
+ config_file:
+ - "openai-gpt-4o-mini.json"
+ - "azure-gpt-4o-mini.json"
+ - "claude-3-5-sonnet.json"
+ - "claude-3-7-sonnet.json"
+ - "claude-3-7-sonnet-extended.json"
+ - "gemini-pro.json"
+ - "gemini-vertex.json"
+ services:
+ qdrant:
+ image: qdrant/qdrant
+ ports:
+ - 6333:6333
+ postgres:
+ image: pgvector/pgvector:pg17
+ ports:
+ - 5432:5432
+ env:
+ POSTGRES_HOST_AUTH_METHOD: trust
+ POSTGRES_DB: postgres
+ POSTGRES_USER: postgres
+ options: >-
+ --health-cmd pg_isready
+ --health-interval 10s
+ --health-timeout 5s
+ --health-retries 5
+ env:
+ # TODO: Uncomment once I am confident this is secure
+ # OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
+ # ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
+ # AZURE_API_KEY: ${{ secrets.AZURE_API_KEY }}
+ # AZURE_BASE_URL: ${{ secrets.AZURE_BASE_URL }}
+ # GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
+ # COMPOSIO_API_KEY: ${{ secrets.COMPOSIO_API_KEY }}
+ # GOOGLE_CLOUD_PROJECT: ${{ secrets.GOOGLE_CLOUD_PROJECT }}
+ # GOOGLE_CLOUD_LOCATION: ${{ secrets.GOOGLE_CLOUD_LOCATION }}
+ # DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
+
+ steps:
+ # Check out base repository code, not the PR's code (for security)
+ - name: Checkout base repository
+ uses: actions/checkout@v4 # No ref specified means it uses base branch
+
+ # Only extract relevant files from the PR (for security, specifically prevent modification of workflow files)
+ - name: Extract PR schema files
+ run: |
+ # Fetch PR without checking it out
+ git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-${{ github.event.pull_request.number }}
+
+ # Extract ONLY the schema files
+ git checkout pr-${{ github.event.pull_request.number }} -- letta/schemas/
+
+ - name: Set up python 3.12
+ id: setup-python
+ uses: actions/setup-python@v5
+ with:
+ python-version: 3.12
+ - name: Load cached Poetry Binary
+ id: cached-poetry-binary
+ uses: actions/cache@v4
+ with:
+ path: ~/.local
+ key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-1.8.3
+ - name: Install Poetry
+ uses: snok/install-poetry@v1
+ with:
+ version: 1.8.3
+ virtualenvs-create: true
+ virtualenvs-in-project: true
+ - name: Load cached venv
+ id: cached-poetry-dependencies
+ uses: actions/cache@v4
+ with:
+ path: .venv
+ key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}${{ inputs.install-args || '-E dev -E postgres -E external-tools -E tests -E cloud-tool-sandbox' }}
+ # Restore cache with this prefix if not exact match with key
+ # Note cache-hit returns false in this case, so the below step will run
+ restore-keys: |
+ venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-
+ - name: Install dependencies
+ if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
+ shell: bash
+ run: poetry install --no-interaction --no-root ${{ inputs.install-args || '-E dev -E postgres -E external-tools -E tests -E cloud-tool-sandbox -E google' }}
+ - name: Install letta packages via Poetry
+ run: |
+ poetry run pip install --upgrade letta-client letta
+ - name: Migrate database
+ env:
+ LETTA_PG_PORT: 5432
+ LETTA_PG_USER: postgres
+ LETTA_PG_PASSWORD: postgres
+ LETTA_PG_DB: postgres
+ LETTA_PG_HOST: localhost
+ run: |
+ psql -h localhost -U postgres -d postgres -c 'CREATE EXTENSION vector'
+ poetry run alembic upgrade head
+ - name: Run integration tests for ${{ matrix.config_file }}
+ env:
+ LLM_CONFIG_FILE: ${{ matrix.config_file }}
+ LETTA_PG_PORT: 5432
+ LETTA_PG_USER: postgres
+ LETTA_PG_PASSWORD: postgres
+ LETTA_PG_DB: postgres
+ LETTA_PG_HOST: localhost
+ LETTA_SERVER_PASS: test_server_token
+ run: |
+ poetry run pytest \
+ -s -vv \
+ tests/integration_test_send_message.py \
+ --maxfail=1 --durations=10