test: Let agentic mock stream large files

What does this merge request do and why?

Adds the ability to load mock responses from files instead of only from the initial input goal.

  • Includes example goals and server-side fixtures/templates.
  • Uses Jinja variable substitution to dynamically insert data into templates.
  • Refactor to use XML parsing where possible instead of potentially less reliable regex.
  • Adds logging for the agentic mock.
  • Disables LangChain caching for the mock model so multiple responses are treated as such.
  • Refactors stream handling to reduce duplication.

Note for reviewers: This was used for load testing as part of https://gitlab.com/gitlab-org/quality/quality-engineering/team-tasks/-/work_items/3794. The core logic (ai_gateway/models/agentic_mock.py) isn't used by unit or integration tests - it's intended to be used with the load tests in https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/-/tree/main/performance_tests/stress_tests

How to set up and validate locally

  1. Set up GDK for testing DAP, but enable mock responses by setting in gitlab-ai-gateway/.env:

    AIGW_MOCK_MODEL_RESPONSES=true
    AIGW_USE_AGENTIC_MOCK=true
  2. Get the id of a project with Duo enabled (1000001 in the example below) and then start a Chat session with:

    {% set projectId = 1000001 %}
     Explain what this project is about.
     <response file='performance_tests/stress_tests/fixtures/list_repo_tree_tool_call.txt' />
     <response file='performance_tests/stress_tests/fixtures/long_analysis.txt' stream='true' chunk_delay_ms='50' />
  3. You should see the list_repository_tree tool used first, then Duo will start streaming the contents of long_analysis.txt.

Merge request checklist

  • Tests added for new functionality. If not, please raise an issue to follow up.
  • Documentation added/updated, if needed.
  • If this change requires executor implementation: verified that issues/MRs exist for both Go executor and Node executor or confirmed that changes are backward-compatible and don't break existing executor functionality.
Edited by Mark Lapierre

Merge request reports

Loading