Swax
Swax is a tool for building traceability graphs of API endpoint dependencies from OpenAPI / Swagger specifications, using a two-pass LLM analysis. Given a spec repository, it infers which API paths depend on which other paths and persists the result as a deterministic graph.
Status: Alpha. The
init,discover, andplancommands are the currently implemented surface.
📖 Documentation: https://qarium.github.io/swax/
Requirements
- Python 3.10 or newer.
- An LLM provider reachable over HTTP (Anthropic- or OpenAI-compatible API).
Installation
python -m venv .venv && source .venv/bin/activate
pip install -e . # runtime
pip install -e '.[test]' # + pytest, ruff (contributors)
pip install -e '.[docs]' # + mkdocs (documentation site)
This installs the swax console script (swax.cli.__main__:main).
Environment
Swax reads three environment variables for the LLM transport. Put them in a
.env file (loaded via the --env-file option) or export them in your shell —
shell values take precedence over the file:
| Variable | Meaning |
|---|---|
SWAX_LLM_PROTOCOL |
Provider identifier: anthropic or openai. |
SWAX_LLM_BASE_URL |
LLM API base URL (without a /v1 or /v2 version segment — the SDK appends it). |
SWAX_LLM_TOKEN |
LLM API token. Never written to logs or error messages. |
Usage
swax --env-file .env init
swax --env-file .env discover
swax --env-file .env plan
--env-file defaults to .env; a missing file is silently ignored.
swax init
Interactively prompts for:
- Repository URL — the git source of the specifications.
- Path to specs inside the repo — the subdirectory to copy.
- Local download path — where the specs land in the project.
It writes .swax/config.yml, shallow-clones the repository (depth=1), and
copies the specs into the local download path. Failures exit with code 1 and a
readable message (Failed to clone <url>: <reason>, Specs not found at <path>).
swax discover
Rebuilds .swax/traceability.yml from scratch (no prompts; reads
.swax/config.yml and the environment). It discovers and parses the local
specs, runs a two-pass LLM analysis (an initial dependency-graph pass, then a
schema-informed refine pass for the uncertain pairs), deduplicates the edges,
and overwrites the traceability graph. Domain failures map to exit code 1 with
messages such as Missing env vars: ..., Failed to parse <path>: <reason>,
LLM rate limited; retry later, LLM call failed: <reason>,
Unsupported LLM protocol: <protocol>, LLM response parse failed: <reason>.
swax plan
Analyzes spec changes and prints a Markdown Impact Report to stdout (no prompts;
reads .swax/config.yml, the environment, and .swax/traceability.yml produced
by swax discover). It parses the local baseline specs, shallow-clones the spec
repository fresh, classifies the endpoint diff (added / removed / modified), maps
the changed endpoints onto the traceability graph to find transitively affected
endpoints, and runs a single-turn LLM analysis. With no changes it skips the LLM
and prints a LOW-risk "No changes detected" report. The report has Summary,
Risk (HIGH / MEDIUM / LOW), Modified Endpoints, Affected Endpoints,
Requirements, and Checklist sections. Domain failures map to exit code 1 with
messages such as Missing env vars: ..., Failed to parse <path>: <reason>,
Failed to clone <url>: <reason>, Specs directory not found at <path>,
Traceability graph not found at <path> — run \swax discover` first, LLM rate limited; retry later, LLM call failed: , Unsupported LLM protocol: , LLM response parse failed: `.
Project layout
.swax/
config.yml # written by `swax init`
traceability.yml # written by `swax discover`
<download_path>/ # the copied specifications
.swax/config.yml shape:
git:
url: https://example.com/specs.git
location: specs
specs:
type: openapi # openapi | swagger
location: downloaded
Development
pytest # full suite
ruff check swax tests # lint
ruff format --check swax tests
License
BSD-3-Clause.
Metadata
Release files for swax 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| swax-1.0.0.tar.gz | 156.9 kB | Without provenance | Details for swax-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swax-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for swax-1.0.0-py3-none-any.whl |
Total release size: 267.3 kB
Release files / swax-1.0.0.tar.gz
| Download URL | swax-1.0.0.tar.gz |
|---|---|
| Size | 156.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f98f2abb5d43d102e04a722e68000097819b8104471fef8b1e465e07dc6ba86
|
|
BLAKE2b-256 checksum How to use checksums |
48a87f990ac26a41d1587eef32775838e77d9dbb0d6f2616623131305047f079
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / swax-1.0.0-py3-none-any.whl
| Download URL | swax-1.0.0-py3-none-any.whl |
|---|---|
| Size | 110.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c3003520fdda119b768b39d0a5d6a478125bee9e092f571722f11332dc2370a0
|
|
BLAKE2b-256 checksum How to use checksums |
d266777876c6f41ece8e810c2ca7265c55dff023b12ff828fa2706da89c47c24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for swax 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.