#1240·SWE-agent

Buggy cost control with Gemini 2.5 Pro

Author: celestinoalanCreated Jul 10, 2025Updated Sep 26, 2026
Labels❔question

Describe the bug

I set the cost cap per instance to $4 and ended up paying >$700 on a single instance!

Steps/commands/code to Reproduce

Command:

bash
sweagent run-batch --num_workers 8 \
    --instances.deployment.docker_args=--memory=10g \
    --config ./gemini-2_5-pro.yaml \
    --instances.path ./instances.yaml \
    --output_dir ./gemini-2_5-pro-trajectories \
    --random_delay_multiplier=1 \

gemini-2_5-pro.yaml:

agent:
  type: default
  templates:
    system_template: |-
      You are a helpful assistant that can interact with a computer to solve tasks.
    instance_template: |-
      <uploaded_files>
      {{working_dir}}
      </uploaded_files>
      I've uploaded a python code repository in the directory {{working_dir}}. Consider the following PR description:

      <pr_description>
      {{problem_statement}}
      </pr_description>

      Can you help me implement the necessary changes to the repository so that the requirements specified in the <pr_description> are met?
      I've already taken care of all changes to any of the test files described in the <pr_description>. This means you DON'T have to modify the testing logic or any of the tests in any way!
      Your task is to make the minimal changes to non-tests files in the {{working_dir}} directory to ensure the <pr_description> is satisfied.
      Follow these steps to resolve the issue:
      1. As a first step, it might be a good idea to find and read code relevant to the <pr_description>
      2. Create a script to reproduce the error and execute it with `python <filename.py>` using the bash tool, to confirm the error
      3. Edit the sourcecode of the repo to resolve the issue
      4. Rerun your reproduce script and confirm that the error is fixed!
      5. Think about edgecases and make sure your fix handles them as well
      Your thinking should be thorough and so it's fine if it's very long.
    next_step_template: |-
      OBSERVATION:
      {{observation}}
    next_step_no_output_template: |-
      Your last command ran successfully and did not produce any output.
  tools:
    execution_timeout: 300
    bundles:
      - path: tools/multilingual_setup
      - path: tools/registry
      - path: tools/edit_anthropic
      - path: tools/review_on_submit_m
      - path: tools/diff_state
    enable_bash_tool: true
    parse_function:
      type: function_calling
    registry_variables:
      USE_FILEMAP: 'true'
      ROOT: "/testbed"
      SUBMIT_REVIEW_MESSAGES:
        - |
          Thank you for your work on this issue. Please carefully follow the steps below to help review your changes.

          1. If you made any changes to your code after running the reproduction script, please run the reproduction script again.
            If the reproduction script is failing, please revisit your changes and make sure they are correct.
            If you have already removed your reproduction script, please ignore this step.
          2. Remove your reproduction script (if you haven't done so already).
          3. If you have modified any TEST files, please revert them to the state they had before you started fixing the issue.
            You can do this with `git checkout -- /path/to/test/file`. Use below <diff> to find the files you need to revert.
          4. Run the submit command again to confirm.

          Here is a list of all of your changes:

          <diff>
          {{diff}}
          </diff>
  history_processors:
    - type: last_n_observations
      n: 5
  model:
    name: gemini-2.5-pro
    api_key: $GOOGLE_API_KEY
    per_instance_cost_limit: 4
    per_instance_call_limit: 150
    total_cost_limit: 300.0
    max_input_tokens: 1048576
    max_output_tokens: 8192
    temperature: 0.0
    delay: 0.0

Error message/results

swebench-google_trajectories_google-samples-2025-07-03_gemini-2_5-pro-trajectories_stretchr__testify-1626_1_stretchr__testify-1626_1.debug.log

System Information

OS Version: Linux alan-swebench-multicore-2 5.10.0-35-cloud-amd64 #1 SMP Debian 5.10.216-1 (2024-07-28) x86_64 GNU/Linux Python Version: Python 3.11.5 sweagent: 1.1.0

Checklist

  • I'm running with the latest docker container/on the latest development version (i.e., I ran git pull))
  • I have copied the full command/code that I ran (as text, not as screenshot!)
  • If applicable: I have copied the full log file/error message that was the result (as text, not as screenshot!)
  • I have enclosed code/log messages in triple backticks (docs) and clicked "Preview" to make sure it's displayed correctly.