Skip to content
Latchkey

Python application workflow (omnirexflora-labs/omnicoreagent)

The Python application workflow from omnirexflora-labs/omnicoreagent, explained and optimized by Latchkey.

D

CI health: D - needs work

Point runs-on at Latchkey and get caching, run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: omnirexflora-labs/omnicoreagent.github/workflows/python-app.ymlLicense MITView source

What it does

This is the Python application workflow from the omnirexflora-labs/omnicoreagent repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python application

on:
  push:
    branches: [ "main", "dev" ]
  pull_request:
    branches: [ "main", "dev" ]

permissions:
  contents: read

jobs:
  build:

    runs-on: ubuntu-latest

    services:
      redis:
        image: redis:7-alpine
        ports:
          - 6379:6379
        options: >-
          --health-cmd "redis-cli ping"
          --health-interval 5s
          --health-timeout 3s
          --health-retries 10
      mongodb:
        image: mongo:7
        ports:
          - 27017:27017
        options: >-
          --health-cmd "mongosh --quiet --eval 'db.adminCommand({ ping: 1 }).ok'"
          --health-interval 10s
          --health-timeout 5s
          --health-retries 12

    steps:
    - uses: actions/checkout@v4
    - name: Set up Python 3.12
      uses: actions/setup-python@v5
      with:
        python-version: "3.12"

    - name: Install uv
      run: |
        python -m pip install --upgrade pip
        pip install uv

    - name: Check if lock file is in sync
      run: |
        if ! uv lock --check; then
          echo "::error::uv.lock is out of sync with pyproject.toml. Please run 'uv lock' locally and commit the updated lock file."
          exit 1
        fi

    - name: Set up virtual environment
      run: |
        uv venv .venv
        echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH

    - name: Cache virtual environment
      uses: actions/cache@v4
      id: venv-cache
      with:
        path: .venv
        key: venv-${{ hashFiles('**/pyproject.toml') }}

    - name: Ensure cache is healthy
      if: steps.venv-cache.outputs.cache-hit == 'true'
      shell: bash
      run: |
        timeout 10s .venv/bin/python -m pip --version || rm -rf .venv

    - name: Install dependencies
      run: |
        uv sync --group dev

    - name: Lint with ruff
      run: |
        ruff check

    - name: Run unit tests with pytest
      run: |
        uv run pytest -v tests -m "not requires_api_key and not requires_network and not broken_upstream"
      env:
        OMNICOREAGENT_TEST_REDIS_URL: redis://localhost:6379/0
        OMNICOREAGENT_TEST_MONGODB_URI: mongodb://localhost:27017
        OMNICOREAGENT_TEST_MONGODB_DATABASE: omnicoreagent_test

    - name: Run live background manager backend tests
      run: |
        uv run pytest -v tests/test_background_durable_manager_integration.py -rs
      env:
        OMNICOREAGENT_TEST_REDIS_URL: redis://localhost:6379/0
        OMNICOREAGENT_TEST_MONGODB_URI: mongodb://localhost:27017
        OMNICOREAGENT_TEST_MONGODB_DATABASE: omnicoreagent_test

    # TODO: Re-enable these test sections when API keys are configured in CI secrets
    # and broken_upstream tests are fixed to match current source code.
    #
    # - name: Run API-dependent tests
    #   run: |
    #     uv run pytest -v tests -m "requires_api_key or requires_network"
    #   env:
    #     OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
    #
    # - name: Run broken upstream tests (pending fixes)
    #   run: |
    #     uv run pytest -v tests -m "broken_upstream"
    #
    # Broken upstream test details (tests written for older source, never updated):
    #
    # test_memory_tool_backend.py (71 tests) - requires_api_key + requires_network
    #   Tests S3/R2 storage backends that need botocore credentials and network access.
    #   Hangs indefinitely without API keys configured.
    #
    # test_background_agent.py::TestBackgroundOmniCoreAgent (8 tests) - broken_upstream
    # test_background_agent.py::TestBackgroundAgentManager (5 tests) - broken_upstream
    #   Fixture patches OmniCoreAgent._save_config_hidden which no longer exists on the class.
    #
    # test_llm.py::TestLLMConnection (5 tests) - broken_upstream
    #   Mock fixture creates LLMConnection with a Mock that returns None from
    #   get_loaded_config(), but __init__ now calls llm_configuration() which
    #   expects a real config dict. Mock setup doesn't match current constructor.
    #
    # test_base.py::test_extract_action_or_answer_fallback_error - broken_upstream
    #   Asserts error contains 'Response must use XML format' but actual message
    #   was changed to 'PARSE ERROR: Response does not use required XML format...'.
    #
    # test_deep_agent.py::TestDeepAgentPromptBuilder::test_orchestration_prompt_structure - broken_upstream
    #   Asserts 'task_complexity_detection' in orchestration prompt, but prompt
    #   was restructured and no longer contains that string.
    #
    # test_deep_agent.py::TestDeepAgentInitialization::test_memory_tool_backend_always_local - broken_upstream
    #   Asserts memory_tool_backend is forced to 'local', but DeepAgent no longer
    #   overrides the backend - it accepts whatever is passed in agent_config.

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
 
name: Python application
 
on:
  push:
    branches: [ "main", "dev" ]
  pull_request:
    branches: [ "main", "dev" ]
 
permissions:
  contents: read
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
 
    runs-on: latchkey-small
 
    services:
      redis:
        image: redis:7-alpine
        ports:
          - 6379:6379
        options: >-
          --health-cmd "redis-cli ping"
          --health-interval 5s
          --health-timeout 3s
          --health-retries 10
      mongodb:
        image: mongo:7
        ports:
          - 27017:27017
        options: >-
          --health-cmd "mongosh --quiet --eval 'db.adminCommand({ ping: 1 }).ok'"
          --health-interval 10s
          --health-timeout 5s
          --health-retries 12
 
    steps:
    - uses: actions/checkout@v4
    - name: Set up Python 3.12
      uses: actions/setup-python@v5
      with:
        cache: 'pip'
        python-version: "3.12"
 
    - name: Install uv
      run: |
        python -m pip install --upgrade pip
        pip install uv
 
    - name: Check if lock file is in sync
      run: |
        if ! uv lock --check; then
          echo "::error::uv.lock is out of sync with pyproject.toml. Please run 'uv lock' locally and commit the updated lock file."
          exit 1
        fi
 
    - name: Set up virtual environment
      run: |
        uv venv .venv
        echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
 
    - name: Cache virtual environment
      uses: actions/cache@v4
      id: venv-cache
      with:
        path: .venv
        key: venv-${{ hashFiles('**/pyproject.toml') }}
 
    - name: Ensure cache is healthy
      if: steps.venv-cache.outputs.cache-hit == 'true'
      shell: bash
      run: |
        timeout 10s .venv/bin/python -m pip --version || rm -rf .venv
 
    - name: Install dependencies
      run: |
        uv sync --group dev
 
    - name: Lint with ruff
      run: |
        ruff check
 
    - name: Run unit tests with pytest
      run: |
        uv run pytest -v tests -m "not requires_api_key and not requires_network and not broken_upstream"
      env:
        OMNICOREAGENT_TEST_REDIS_URL: redis://localhost:6379/0
        OMNICOREAGENT_TEST_MONGODB_URI: mongodb://localhost:27017
        OMNICOREAGENT_TEST_MONGODB_DATABASE: omnicoreagent_test
 
    - name: Run live background manager backend tests
      run: |
        uv run pytest -v tests/test_background_durable_manager_integration.py -rs
      env:
        OMNICOREAGENT_TEST_REDIS_URL: redis://localhost:6379/0
        OMNICOREAGENT_TEST_MONGODB_URI: mongodb://localhost:27017
        OMNICOREAGENT_TEST_MONGODB_DATABASE: omnicoreagent_test
 
    # TODO: Re-enable these test sections when API keys are configured in CI secrets
    # and broken_upstream tests are fixed to match current source code.
    #
    # - name: Run API-dependent tests
    #   run: |
    #     uv run pytest -v tests -m "requires_api_key or requires_network"
    #   env:
    #     OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
    #
    # - name: Run broken upstream tests (pending fixes)
    #   run: |
    #     uv run pytest -v tests -m "broken_upstream"
    #
    # Broken upstream test details (tests written for older source, never updated):
    #
    # test_memory_tool_backend.py (71 tests) - requires_api_key + requires_network
    #   Tests S3/R2 storage backends that need botocore credentials and network access.
    #   Hangs indefinitely without API keys configured.
    #
    # test_background_agent.py::TestBackgroundOmniCoreAgent (8 tests) - broken_upstream
    # test_background_agent.py::TestBackgroundAgentManager (5 tests) - broken_upstream
    #   Fixture patches OmniCoreAgent._save_config_hidden which no longer exists on the class.
    #
    # test_llm.py::TestLLMConnection (5 tests) - broken_upstream
    #   Mock fixture creates LLMConnection with a Mock that returns None from
    #   get_loaded_config(), but __init__ now calls llm_configuration() which
    #   expects a real config dict. Mock setup doesn't match current constructor.
    #
    # test_base.py::test_extract_action_or_answer_fallback_error - broken_upstream
    #   Asserts error contains 'Response must use XML format' but actual message
    #   was changed to 'PARSE ERROR: Response does not use required XML format...'.
    #
    # test_deep_agent.py::TestDeepAgentPromptBuilder::test_orchestration_prompt_structure - broken_upstream
    #   Asserts 'task_complexity_detection' in orchestration prompt, but prompt
    #   was restructured and no longer contains that string.
    #
    # test_deep_agent.py::TestDeepAgentInitialization::test_memory_tool_backend_always_local - broken_upstream
    #   Asserts memory_tool_backend is forced to 'local', but DeepAgent no longer
    #   overrides the backend - it accepts whatever is passed in agent_config.
 

What changed

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow