Skip to content

Commit 6522057

Browse files
Add Tutorial, GPT-5 and improve installation. (#278)
* tutorial * Update readme to include test note * update toml to dynamic requirements and add uv.lock file * Add tutorial to setup python env with uv * tutorial 2 * Update dependencies in pyproject.toml and uv.lock to allow for newer versions of torch and add anthropic * Implement code changes to enhance functionality and improve performance * Fix tutorial instructions by moving git clone and cd commands to the correct section * Refactor tutorial content and remove commented-out dependencies in pyproject.toml * add instruction to activate the env * Add support for GPT-5 models and update tutorial instructions * Update OpenAI API Key instructions in tutorial * Refactor tutorial headings for consistency and clarity * add oai oss and gpt-5 models * Update deperecated param `max_tokens`-> `max_completion_tokens` in chat_api * add OpenRouter versions of gpt 5 model series. * port o3 model to openrouter * update response api test * remove deprecated o1-mini model from main.py * Add Gpt-5-nano in tool-use-agent * fix GPT 5 mini and nano config * Add litellm pricing as a backup princing backend. * Add GPT-5 mini agent * Add GPT-5-Mini to agentlab-assistant. * Add initial readme for prompt injection tutorial * add ipykernal and dot_env to dependency * add notebook to setup miniwob and launch experiments. * update formatting in launch_experiments.ipynb * update readme in 2_eval_on_miniwob * update readme for 2_eval_on_miniwob and grammar fix. * grammar fix readme tutorial 2. * Add prompt injection tutorials and update attack scenarios - Created new attack scenario in `attack_2.txt` to simulate identity verification prompts for agents and digital assistants. - Added detailed instructions and observations in `prompt_0.txt` for listing reviewers mentioning small ear cups. - Introduced `prompt_2.txt` to track food-related shopping expenses for March 2023, including comprehensive action space and interaction history. * update T1 readme with a note to install additional playwright deps. * Update readme.md * Update readme.md * Update readme.md * clear output * add miniwob automatic install in agentlab. * update experiment.py to include miniwob auto-install and envars export in T2 * black refactor agent-config.py * Add cmd to checkout tutorial branch * remove launch_experiment notebook from T2 * minor fixes in T1 read me and spell check, * update CI/CD to use uv * Implement code changes to enhance functionality and improve performance * Update README and experiment script for clarity and consistency * Fix stale tests. * fix stale test * add darglint as dev dependency * update CI/CD apply formatting only src. * update darglint to be run from py3.12 --------- Co-authored-by: recursix <[email protected]>
1 parent 219e467 commit 6522057

33 files changed

+8673
-109
lines changed

.github/workflows/code_format.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,19 @@ jobs:
1818
- name: Checkout Repository
1919
uses: actions/checkout@v4
2020

21-
- name: Set up Python
22-
uses: actions/setup-python@v5
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v4
2323
with:
24-
python-version: '3.11'
25-
cache: 'pip' # caching pip dependencies
24+
enable-cache: true
25+
26+
- name: Set up Python
27+
run: uv python install 3.11
2628

27-
- name: Pip install
28-
run: pip install -r requirements.txt
29+
- name: Install dependencies
30+
run: uv sync --frozen --extra dev
2931

30-
- name: Pip list
31-
run: pip list
32+
- name: List packages
33+
run: uv pip list
3234

3335
- name: Code Formatting
34-
run: black . --check --diff
36+
run: uv run black src/ --check --diff

.github/workflows/darglint.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,19 @@ jobs:
1818
- name: Checkout Repository
1919
uses: actions/checkout@v4
2020

21-
- name: Set up Python
22-
uses: actions/setup-python@v5
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v4
2323
with:
24-
python-version: '3.12'
25-
cache: 'pip' # caching pip dependencies
24+
enable-cache: true
25+
26+
- name: Set up Python
27+
run: uv python install 3.12 # this fails in 3.11
2628

27-
- name: Pip install
28-
run: pip install darglint
29+
- name: Install dependencies
30+
run: uv sync --frozen --extra dev
2931

30-
- name: Pip list
31-
run: pip list
32+
- name: List packages
33+
run: uv pip list
3234

3335
- name: Darglint checks
34-
run: darglint -v 2 -z short src/
36+
run: uv run darglint -v 2 -z short src/

.github/workflows/python_version_compatibility.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ jobs:
3232
- name: Check Python ${{ matrix.python-version }}
3333
continue-on-error: true
3434
run: |
35-
export PATH="$HOME/.cargo/bin:$PATH"
36-
if uvx --python ${{ matrix.python-version }} --from python --with-requirements requirements.txt python -c "print('✅ Compatible')"; then
37-
echo "✅ Python ${{ matrix.python-version }} works"
38-
else
39-
echo "❌ Python ${{ matrix.python-version }} incompatible"
40-
fi
35+
export PATH="$HOME/.cargo/bin:$PATH"
36+
uv python install ${{ matrix.python-version }}
37+
if uv sync --frozen --python ${{ matrix.python-version }}; then
38+
uv run -p ${{ matrix.python-version }} python -c "import sys; print('✅ Compatible:', sys.version)"
39+
echo "✅ Python ${{ matrix.python-version }} works"
40+
else
41+
echo "❌ Python ${{ matrix.python-version }} incompatible"
42+
exit 1
43+
fi

.github/workflows/unit_tests.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,25 @@ jobs:
2323
- name: Set up Git user
2424
run: git config --global user.email "[email protected]" && git config --global user.name "GitHub Actions"
2525

26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v4
28+
with:
29+
enable-cache: true
30+
2631
- name: Set up Python
27-
uses: actions/setup-python@v5
28-
with: # python at least 3.11
29-
python-version: '3.11'
30-
cache: 'pip' # caching pip dependencies
32+
run: uv python install 3.11
3133

3234
- name: Install AgentLab
33-
run: pip install -e .
35+
run: uv sync --frozen --extra dev
3436

35-
- name: Pip list
36-
run: pip list
37+
- name: List packages
38+
run: uv pip list
3739

3840
- name: Install Playwright
39-
run: playwright install chromium --with-deps
41+
run: uv run playwright install chromium --with-deps
4042

4143
- name: Download WebArena / VisualWebArena ressource files
42-
run: python -c 'import nltk; nltk.download("punkt_tab")'
44+
run: uv run python -c 'import nltk; nltk.download("punkt_tab")'
4345

4446
- name: Fetch MiniWob
4547
uses: actions/checkout@v4
@@ -59,9 +61,9 @@ jobs:
5961
run: curl -I "http://localhost:8080/miniwob/" || echo "MiniWob not reachable"
6062

6163
- name: Pre-download nltk ressources
62-
run: python -c "import nltk; nltk.download('punkt_tab')"
64+
run: uv run python -c "import nltk; nltk.download('punkt_tab')"
6365

6466
- name: Run AgentLab Unit Tests
6567
env:
6668
MINIWOB_URL: "http://localhost:8080/miniwob/"
67-
run: pytest -n 5 --durations=10 -m 'not pricy' -v tests/
69+
run: uv run pytest -n 5 --durations=10 -m 'not pricy' -v tests/

.readthedocs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,8 @@ sphinx:
3232
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
3333
python:
3434
install:
35+
- method: pip
36+
path: .
37+
extra_requirements:
38+
- dev
3539
- requirements: docs/source/requirements.txt

docs/source/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
agentlab
2-
sphinx-rtd-theme
1+
sphinx-rtd-theme
2+
sphinx

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
AGENT_4o,
1616
AGENT_4o_MINI,
1717
AGENT_o3_MINI,
18-
AGENT_o1_MINI,
1918
AGENT_37_SONNET,
2019
AGENT_CLAUDE_SONNET_35,
20+
AGENT_GPT5_MINI,
2121
)
2222
from agentlab.experiments.study import Study
2323

pyproject.toml

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "agentlab"
7-
dynamic = ["version", "dependencies"]
7+
dynamic = ["version"]
88
description = "Main package for developing agents and experiments"
99
authors = [
1010
{name = "Rim Assouel", email = "[email protected]"},
@@ -27,13 +27,55 @@ classifiers = [
2727
"Topic :: Scientific/Engineering :: Artificial Intelligence",
2828
"License :: OSI Approved :: Apache Software License",
2929
]
30+
dependencies = [
31+
"pydantic~=2.9",
32+
"dask",
33+
"distributed",
34+
"browsergym>=0.7.1",
35+
"joblib>=1.2.0",
36+
"openai>=1.7,<2",
37+
"langchain_community",
38+
"tiktoken",
39+
"huggingface_hub",
40+
"contexttimer",
41+
"ipython",
42+
"pyyaml>=6",
43+
"pandas",
44+
"gradio>=5.5",
45+
"gitpython",
46+
"requests",
47+
"matplotlib",
48+
"ray[default]",
49+
"python-slugify",
50+
"pillow",
51+
"gymnasium>=0.27",
52+
"torch>=2.2.2",
53+
"safetensors>=0.4.0",
54+
"transformers>=4.38.2",
55+
"anthropic>=0.62.0",
56+
"litellm>=1.75.3",
57+
"python-dotenv>=1.1.1",
58+
]
59+
60+
[project.optional-dependencies]
61+
dev = [
62+
"black[jupyter]>=24.2.0",
63+
"blacken-docs",
64+
"pre-commit",
65+
"pytest==7.3.2",
66+
"flaky",
67+
"pytest-xdist",
68+
"pytest-playwright",
69+
]
70+
# tapeagents = [
71+
# "tapeagents[converters]",
72+
# ]
3073

3174
[project.urls]
3275
"Homepage" = "https://github.com/ServiceNow/AgentLab"
3376

3477
[tool.setuptools.dynamic]
3578
version = {attr = "agentlab.__version__"}
36-
dependencies = {file = ["requirements.txt"]}
3779

3880
[tool.black]
3981
line-length = 100
@@ -54,6 +96,13 @@ exclude = '''
5496
)/
5597
'''
5698

99+
[dependency-groups]
100+
dev = [
101+
"darglint>=1.8.1",
102+
"ipykernel>=6.30.1",
103+
"pip>=25.2",
104+
]
105+
57106

58107
[project.scripts]
59108
agentlab-assistant = "agentlab.ui_assistant:main"

requirements.txt

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/agentlab/agents/generic_agent/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
AGENT_o3_MINI,
2727
FLAGS_GPT_4o,
2828
GenericAgentArgs,
29+
AGENT_GPT5_MINI,
2930
)
3031

3132
__all__ = [
@@ -46,4 +47,5 @@
4647
"AGENT_4o_VISION",
4748
"AGENT_4o_MINI_VISION",
4849
"AGENT_CLAUDE_SONNET_35_VISION",
50+
"AGENT_GPT5_MINI",
4951
]

0 commit comments

Comments
 (0)