We use Rye to manage dependencies because it will automatically provision a Python environment with the expected Python version. To set it up, run:
$ ./scripts/bootstrapOr install Rye manually and run:
$ rye sync --all-featuresYou can then run scripts using rye run python script.py or by activating the virtual environment:
# Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work
$ source .venv/bin/activate
# now you can omit the `rye run` prefix
$ python script.pyAlternatively if you don't want to install Rye, you can stick with the standard pip setup by ensuring you have the Python version specified in .python-version, create a virtual environment however you desire and then install dependencies using this command:
$ pip install -r requirements-dev.lockThis repository is generated and released by Stainless. To keep the release pipeline working, contributions need to follow the branch model and commit conventions below.
- Always open PRs against the
nextbranch — notmain. Stainless watchesnextto produce SDK builds and the automated version-bump PR. - Typical flow:
- Pull the latest
nextlocally and branch off it. - Make and push your changes, then open a PR targeting
next. - Get the PR reviewed and merged into
next. - Stainless will open (or update) a release PR bumping the version — review and merge that PR
to ship to
main/PyPI. A new release PR will not be cut while a previous one is still open, so unblock pending release PRs before expecting a new one.
- Pull the latest
- Do not merge generated code directly into
nextvia PR. Let the generator produce those changes. - The
Validate PR base branchCI check fails on PRs targetingmainfrom non-automation accounts and posts a comment with resolution steps. If you genuinely need to PR directly tomain(e.g. an urgent hotfix), add thetarget-mainlabel to bypass the check.
Commit messages and PR titles must follow Conventional Commits,
because the changelog and release notes are derived from them. The Validate PR title (Conventional Commits)
CI check enforces this on every PR. Common prefixes:
feat(api): ...— new functionalityfix(types): ...— bug fixesdocs(readme): ...— documentation-only changes (required for manual README/docs overrides to be picked up by the generator)chore(internal): ...— internal changes that don't affect users
Most of the SDK is generated code. Modifications to code will be persisted between generations, but may
result in merge conflicts between manual patches and changes from the generator. The generator will never
modify the contents of the src/agentex/lib/ and examples/ directories.
All files in the examples/ directory are not modified by the generator and can be freely edited or added to.
# add an example to examples/<your-example>.py
#!/usr/bin/env -S rye run python
…$ chmod +x examples/<your-example>.py
# run the example against your api
$ ./examples/<your-example>.pyIf you’d like to use the repository from source, you can either install from git or link to a cloned repository:
To install via git:
$ pip install git+ssh://git@github.com/scaleapi/scale-agentex-python.gitAlternatively, you can build from source and install the wheel file:
Building this package will create two files in the dist/ directory, a .tar.gz containing the source files and a .whl that can be used to install the package efficiently.
To create a distributable version of the library, all you have to do is run this command:
$ rye build
# or
$ python -m buildThen to install:
$ pip install ./path-to-wheel-file.whl$ ./scripts/testThis repository uses ruff and black to format the code in the repository.
To lint:
$ ./scripts/lintTo format and fix all ruff issues automatically:
$ ./scripts/formatChanges made to this repository via the automated release PR pipeline should publish to PyPI automatically. If the changes aren't made through the automated pipeline, you may want to make releases manually.
You can release to package managers by using the Publish PyPI GitHub action. This requires a setup organization or repository secret to be set up.
If you need to manually release a package, you can run the bin/publish-pypi script with a PYPI_TOKEN set on
the environment.
This repository is setup with some pre-canned prompts for Claude Code as well as Cursor.