LbAgents 0.18.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. lbagents-0.18.2/.gitignore +115 -0
  2. lbagents-0.18.2/.gitlab-ci.yml +150 -0
  3. lbagents-0.18.2/.pre-commit-config.yaml +32 -0
  4. lbagents-0.18.2/COPYING +674 -0
  5. lbagents-0.18.2/PKG-INFO +851 -0
  6. lbagents-0.18.2/README.md +144 -0
  7. lbagents-0.18.2/deploy/agent-14b.yaml +28 -0
  8. lbagents-0.18.2/eval/README.md +148 -0
  9. lbagents-0.18.2/eval/__init__.py +49 -0
  10. lbagents-0.18.2/eval/baselines.json +97 -0
  11. lbagents-0.18.2/eval/conftest.py +66 -0
  12. lbagents-0.18.2/eval/langfuse_utils.py +64 -0
  13. lbagents-0.18.2/eval/loader.py +99 -0
  14. lbagents-0.18.2/eval/metrics.py +453 -0
  15. lbagents-0.18.2/eval/mock_llm.py +70 -0
  16. lbagents-0.18.2/eval/mock_tools.py +119 -0
  17. lbagents-0.18.2/eval/models.py +71 -0
  18. lbagents-0.18.2/eval/runner.py +279 -0
  19. lbagents-0.18.2/eval/scenarios/__init__.py +0 -0
  20. lbagents-0.18.2/eval/scenarios/ci_failure_api_error.yaml +190 -0
  21. lbagents-0.18.2/eval/scenarios/ci_failure_cvmfs_missing.yaml +155 -0
  22. lbagents-0.18.2/eval/scenarios/ci_failure_memory_limit.yaml +184 -0
  23. lbagents-0.18.2/eval/scenarios/mattermost_api_timeout.yaml +94 -0
  24. lbagents-0.18.2/eval/scenarios/mattermost_ci_failed.yaml +118 -0
  25. lbagents-0.18.2/eval/scenarios/mattermost_why_stuck.yaml +105 -0
  26. lbagents-0.18.2/eval/scenarios/stuck_production_empty_response.yaml +141 -0
  27. lbagents-0.18.2/eval/scenarios/stuck_production_maxreset.yaml +140 -0
  28. lbagents-0.18.2/eval/scenarios/stuck_production_stalled.yaml +124 -0
  29. lbagents-0.18.2/eval/test_layer1.py +221 -0
  30. lbagents-0.18.2/eval/test_layer2.py +215 -0
  31. lbagents-0.18.2/manifests/lhcb-orchestrator-small.yaml +29 -0
  32. lbagents-0.18.2/pixi.lock +1651 -0
  33. lbagents-0.18.2/pixi.toml +23 -0
  34. lbagents-0.18.2/pyproject.toml +75 -0
  35. lbagents-0.18.2/setup.cfg +4 -0
  36. lbagents-0.18.2/src/LbAgents/__init__.py +23 -0
  37. lbagents-0.18.2/src/LbAgents/context.py +215 -0
  38. lbagents-0.18.2/src/LbAgents/graphs/__init__.py +182 -0
  39. lbagents-0.18.2/src/LbAgents/graphs/ap_debug_ci_failure.py +225 -0
  40. lbagents-0.18.2/src/LbAgents/graphs/ap_debug_ci_failure_v2.py +1372 -0
  41. lbagents-0.18.2/src/LbAgents/graphs/ap_debug_stuck_productions.py +137 -0
  42. lbagents-0.18.2/src/LbAgents/graphs/mattermost_debug_user_request.py +143 -0
  43. lbagents-0.18.2/src/LbAgents/graphs/nightly_failure_summary.py +101 -0
  44. lbagents-0.18.2/src/LbAgents/prompts/__init__.py +0 -0
  45. lbagents-0.18.2/src/LbAgents/prompts/templates.py +446 -0
  46. lbagents-0.18.2/src/LbAgents/registry.py +54 -0
  47. lbagents-0.18.2/src/LbAgents/schemas/__init__.py +0 -0
  48. lbagents-0.18.2/src/LbAgents/schemas/state.py +171 -0
  49. lbagents-0.18.2/src/LbAgents/skills/__init__.py +10 -0
  50. lbagents-0.18.2/src/LbAgents/skills/debug-ci-failure/SKILL.md +108 -0
  51. lbagents-0.18.2/src/LbAgents/skills/debug-stuck-production/SKILL.md +48 -0
  52. lbagents-0.18.2/src/LbAgents/skills/mattermost-support/SKILL.md +44 -0
  53. lbagents-0.18.2/src/LbAgents/skills/summarize-nightly-failures/SKILL.md +130 -0
  54. lbagents-0.18.2/src/LbAgents/tools/__init__.py +21 -0
  55. lbagents-0.18.2/src/LbAgents/tools/gitlab.py +225 -0
  56. lbagents-0.18.2/src/LbAgents/tools/nightly.py +284 -0
  57. lbagents-0.18.2/src/LbAgents.egg-info/PKG-INFO +851 -0
  58. lbagents-0.18.2/src/LbAgents.egg-info/SOURCES.txt +63 -0
  59. lbagents-0.18.2/src/LbAgents.egg-info/dependency_links.txt +1 -0
  60. lbagents-0.18.2/src/LbAgents.egg-info/not-zip-safe +1 -0
  61. lbagents-0.18.2/src/LbAgents.egg-info/requires.txt +20 -0
  62. lbagents-0.18.2/src/LbAgents.egg-info/top_level.txt +1 -0
  63. lbagents-0.18.2/tests/__init__.py +0 -0
  64. lbagents-0.18.2/tests/test_context.py +175 -0
  65. lbagents-0.18.2/tests/test_graphs.py +161 -0
@@ -0,0 +1,115 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # Installer logs
30
+ pip-log.txt
31
+ pip-delete-this-directory.txt
32
+
33
+ # Unit test / coverage reports
34
+ htmlcov/
35
+ .tox/
36
+ .nox/
37
+ .coverage
38
+ .coverage.*
39
+ .cache
40
+ nosetests.xml
41
+ coverage.xml
42
+ cov.xml
43
+ *.cover
44
+ *.py,cover
45
+ .hypothesis/
46
+ .pytest_cache/
47
+ cover/
48
+
49
+ # Translations
50
+ *.mo
51
+ *.pot
52
+
53
+ # Sphinx documentation
54
+ docs/_build/
55
+
56
+ # PyBuilder
57
+ .pybuilder/
58
+ target/
59
+
60
+ # Jupyter Notebook
61
+ .ipynb_checkpoints
62
+
63
+ # IPython
64
+ profile_default/
65
+ ipython_config.py
66
+
67
+ # pyenv
68
+ # .python-version
69
+
70
+ # PEP 582
71
+ __pypackages__/
72
+
73
+ # Environments
74
+ .env
75
+ .venv
76
+ env/
77
+ venv/
78
+ ENV/
79
+ env.bak/
80
+ venv.bak/
81
+
82
+ # Pixi
83
+ .pixi/
84
+
85
+ # Rope project settings
86
+ .ropeproject
87
+
88
+ # mypy
89
+ .mypy_cache/
90
+ .dmypy.json
91
+ dmypy.json
92
+
93
+ # Pyre type checker
94
+ .pyre/
95
+
96
+ # pytype static type analyzer
97
+ .pytype/
98
+
99
+ # Cython debug symbols
100
+ cython_debug/
101
+
102
+ # Ruff
103
+ .ruff_cache/
104
+
105
+ # OS
106
+ .DS_Store
107
+
108
+ # IDE
109
+ *.code-workspace
110
+ .idea/
111
+ .vscode/
112
+
113
+ # Eval results (runtime artifacts)
114
+ eval/results.json
115
+ eval_results.xml
@@ -0,0 +1,150 @@
1
+ ###############################################################################
2
+ # (c) Copyright 2026 CERN for the benefit of the LHCb Collaboration #
3
+ # #
4
+ # This software is distributed under the terms of the GNU General Public #
5
+ # Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
6
+ # #
7
+ # In applying this licence, CERN does not waive the privileges and immunities #
8
+ # granted to it by virtue of its status as an Intergovernmental Organization #
9
+ # or submit itself to any jurisdiction. #
10
+ ###############################################################################
11
+ include:
12
+ - project: 'lhcb-dpa/analysis-productions/LbAPI'
13
+ ref: main
14
+ file: '/ci/update-lbapi-dependency.gitlab-ci.yml'
15
+
16
+ default:
17
+ tags:
18
+ - cvmfs
19
+
20
+ stages:
21
+ - test
22
+ - eval
23
+ - deploy
24
+
25
+ ###############################################################################
26
+ # Pixi setup
27
+ ###############################################################################
28
+
29
+ .pixi-setup:
30
+ image: gitlab-registry.cern.ch/lhcb-docker/os-base/alma9-devel:latest
31
+ before_script:
32
+ - curl -fsSL https://pixi.sh/install.sh | sh
33
+ - source ~/.bashrc || true
34
+ tags:
35
+ - cvmfs
36
+
37
+ ###############################################################################
38
+ # Testing
39
+ ###############################################################################
40
+
41
+ pre-commit:
42
+ stage: test
43
+ extends: .pixi-setup
44
+ script:
45
+ - pixi run pre-commit
46
+ variables:
47
+ PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
48
+
49
+ tests:
50
+ stage: test
51
+ extends: .pixi-setup
52
+ script:
53
+ - pixi run test
54
+
55
+ check-lockfile:
56
+ stage: test
57
+ extends: .pixi-setup
58
+ script:
59
+ - pixi install
60
+ - |
61
+ if [ -n "$(git status --porcelain pixi.lock)" ]; then
62
+ echo "ERROR: pixi.lock is out of sync with pixi.toml"
63
+ echo "Please run 'pixi install' locally and commit the updated pixi.lock"
64
+ echo ""
65
+ echo "Changes detected:"
66
+ git diff pixi.lock
67
+ exit 1
68
+ fi
69
+ - echo "pixi.lock is up to date"
70
+
71
+ ###############################################################################
72
+ # Evaluation
73
+ ###############################################################################
74
+
75
+ eval:layer1:
76
+ stage: eval
77
+ extends: .pixi-setup
78
+ script:
79
+ - pixi run pytest eval/test_layer1.py -v
80
+ rules:
81
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
82
+
83
+ eval:layer2:
84
+ stage: eval
85
+ extends: .pixi-setup
86
+ variables:
87
+ LLM_API_KEY: ${LLM_API_KEY}
88
+ LLM_BASE_URL: ${LLM_BASE_URL}
89
+ LLM_MODEL: ${LLM_MODEL}
90
+ script:
91
+ - |
92
+ if [ -z "$LLM_API_KEY" ]; then
93
+ echo "ERROR: LLM_API_KEY is not set. Configure it in GitLab CI/CD variables (masked)."
94
+ exit 1
95
+ fi
96
+ - pixi run pytest eval/test_layer2.py -m layer2 -v --junitxml=eval_results.xml
97
+ artifacts:
98
+ paths:
99
+ - eval/results.json
100
+ reports:
101
+ junit: eval_results.xml
102
+ when: always
103
+ allow_failure: true
104
+ rules:
105
+ # Auto-trigger on MR changes when credentials are available
106
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event" && $LLM_API_KEY
107
+ changes:
108
+ - src/LbAgents/graphs/**/*
109
+ - src/LbAgents/skills/**/*
110
+ - src/LbAgents/prompts/**/*
111
+ - eval/**/*
112
+ # Manual trigger (always available in MRs and from UI)
113
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
114
+ when: manual
115
+ - if: $CI_PIPELINE_SOURCE == "web"
116
+
117
+ test-build:
118
+ stage: test
119
+ image: registry.cern.ch/docker.io/library/python:3.12
120
+ before_script:
121
+ - pip install build
122
+ script:
123
+ - python -m build
124
+
125
+ ###############################################################################
126
+ # Deploy
127
+ ###############################################################################
128
+
129
+ deploy-packages:
130
+ stage: deploy
131
+ image: registry.cern.ch/docker.io/library/python:3.12
132
+ before_script:
133
+ - pip install build twine
134
+ script:
135
+ - python -m build
136
+ - if [ -z "$PYPI_DEPLOY_TOKEN" ] ; then echo "Set PYPI_DEPLOY_TOKEN in CI variables" ; exit 1 ; fi
137
+ - twine upload -u __token__ -p "$PYPI_DEPLOY_TOKEN" dist/*
138
+ rules:
139
+ - if: $CI_COMMIT_TAG
140
+
141
+ update-lbapi:
142
+ extends: .update-lbapi-dependency
143
+ stage: deploy
144
+ variables:
145
+ PACKAGE_NAME: "lbagents"
146
+ GIT_TAG: "true"
147
+ LBAPI_UPDATE_TOKEN: "${LBAPI_ACCESS_TOKEN}"
148
+ PYPI_WAIT_SECONDS: "0"
149
+ rules:
150
+ - if: $CI_COMMIT_TAG
@@ -0,0 +1,32 @@
1
+ # See https://pre-commit.com for more information
2
+ # See https://pre-commit.com/hooks.html for more hooks
3
+
4
+ default_language_version:
5
+ python: python3
6
+
7
+ repos:
8
+ - repo: https://github.com/pre-commit/pre-commit-hooks
9
+ rev: v6.0.0
10
+ hooks:
11
+ - id: trailing-whitespace
12
+ - id: end-of-file-fixer
13
+ - id: check-yaml
14
+ - id: check-added-large-files
15
+ - id: no-commit-to-branch
16
+ args: [--branch, master]
17
+
18
+ - repo: https://github.com/psf/black
19
+ rev: 26.1.0
20
+ hooks:
21
+ - id: black
22
+
23
+ - repo: https://github.com/charliermarsh/ruff-pre-commit
24
+ rev: 'v0.15.4'
25
+ hooks:
26
+ - id: ruff
27
+ args: ["--fix"]
28
+
29
+ - repo: "https://gitlab.cern.ch/lhcb-core/LbDevTools.git"
30
+ rev: 2.1.6
31
+ hooks:
32
+ - id: lb-add-copyright