Add your description here
Project description
▄████████ ▄█ ▄█ █▄ ▄████████ ███ ███ ███ ███ ███ ███ ███ ███ ▀█████████▄ ███ ███ ███▌ ███ ███ ███ █▀ ▀███▀▀██ ▄███▄▄▄▄██▀ ███▌ ███ ███ ▄███▄▄▄ ███ ▀ ▀▀███▀▀▀▀▀ ███▌ ███ ███ ▀▀███▀▀▀ ███ ▀███████████ ███ ███ ███ ███ █▄ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ █▀ ▀██████▀ ██████████ ▄████▀ ███ ███
Generate production-ready API clients from documentation in minutes, not days.
⚡ What is Rivet?
Rivet is not just a code generator; it is an autonomous software engineer dedicated to building Python SDKs.
Unlike standard OpenAPI generators that produce rigid, un-pythonic code, Rivet uses a multi-stage Agentic Architecture to read your Swagger/OpenAPI documentation, slice the specification to your exact needs, and generate robust, Pydantic-validated SDKs.
The Killer Feature: Rivet verifies its own work. It spins up a Docker container, runs pytest against the generated code, and if the tests fail, it reads the error logs and fixes the code automatically.
🚀 Key Features
🎯 Context Slicing: Don't need the whole 5,000-endpoint API? Rivet intelligently slices the OpenAPI spec to generate only the micro-SDK you requested (e.g., "Just the Payment endpoints").
🛡️ Type-Safety First: Generates strictly typed Pydantic v2 models for all requests and responses.
🔄 Self-Healing Loop: Generated code is executed in a sandbox. If pytest fails, the "Auditor" agent analyzes the stack trace and refactors the code until it passes.
📚 Documentation RAG: Scrapes your HTML documentation to enrich the SDK with better docstrings and edge-case handling than the raw spec provides.
🏗️ Architecture
Puff operates in a three-stage pipeline to ensure quality and correctness.
graph TD
%% Node Definitions
Ingest[("Ingest Node<br/>(Fetch Spec & Docs)")]
Slice[("Slice Node<br/>(Filter Spec)")]
GenSDK[("Generate SDK<br/>(LLM: Create client.py)")]
ValSDK[("Validate SDK<br/>(Syntax & Import Check)")]
GenTests[("Generate Tests<br/>(LLM: Create test_client.py)")]
RunTests[("Run Tests<br/>(Pytest execution)")]
FixSDK[("Fix SDK Targeted<br/>(LLM: Surgical Fix)")]
FixTests[("Fix Tests Targeted<br/>(LLM: Adjust Tests)")]
%% End Node
End((End/Success))
Fail((End/Fail))
%% Styles with Darker Backgrounds and Lighter Text
style Ingest fill:#023e58,stroke:#01579b,stroke-width:2px,color:#ffffff
style Slice fill:#023e58,stroke:#01579b,stroke-width:2px,color:#ffffff
style GenSDK fill:#1b5e20,stroke:#2e7d32,stroke-width:2px,color:#ffffff
style ValSDK fill:#f57f17,stroke:#fbc02d,stroke-width:2px,color:#ffffff
style GenTests fill:#1b5e20,stroke:#2e7d32,stroke-width:2px,color:#ffffff
style RunTests fill:#f57f17,stroke:#fbc02d,stroke-width:2px,color:#ffffff
style FixSDK fill:#bf360c,stroke:#d84315,stroke-width:2px,stroke-dasharray: 5 5,color:#ffffff
style FixTests fill:#bf360c,stroke:#d84315,stroke-width:2px,stroke-dasharray: 5 5,color:#ffffff
style End fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#ffffff
style Fail fill:#c62828,stroke:#b71c1c,stroke-width:2px,color:#ffffff
%% Main Flow
Ingest --> Slice
Slice --> GenSDK
GenSDK --> ValSDK
%% Validation Routing (route_after_sdk_validation)
ValSDK -- "Status: sdk_valid" --> GenTests
ValSDK -- "Status: sdk_invalid (Retry < 3)" --> FixSDK
ValSDK -- "Status: sdk_invalid (Retry >= 3)" --> Fail
%% SDK Fix Loop (Validation Cycle)
FixSDK --> ValSDK
%% Test Flow
GenTests --> RunTests
%% Test Routing (route_after_test)
RunTests -- "Status: success" --> End
RunTests -- "Status: test_failed" --> Analyze{Error Analysis}
%% Error Analysis Routing
Analyze -- "Is SDK Error? (Retry < 3)" --> FixSDK
Analyze -- "Is SDK Error? (Retry >= 3)" --> Fail
Analyze -- "Is Test Error? (Retry < 3)" --> FixTests
Analyze -- "Is Test Error? (Retry >= 3)" --> Fail
%% Test Fix Loop (Execution Cycle)
%% Note: Test fixes go straight back to execution, skipping SDK validation
FixTests --> RunTests
1. The Architect (Analysis)
Rivet pulls the full OpenAPI specification. If you asked for a specific feature set, the Spec Slicer traverses the reference graph to isolate only the relevant endpoints and their dependent data models, creating a "Mini-Spec."
2. The Builder (Generation)
A LangGraph Coding Agent, equipped with the Mini-Spec and RAG context from your documentation, generates the Python SDK (client.py) and a matching Test Suite (test_client.py). It adheres to strict PEP 8 and Pydantic v2 standards.
3. The Auditor (Verification)
This is where the magic happens.
-
The code is injected into an isolated Docker Container.
-
pytest is executed.
-
If tests pass: The SDK is packaged and delivered to you.
-
If tests fail: The Error Analyzer captures the
stderroutput, diagnoses the crash (e.g.,ImportError,ValidationError), and feeds this feedback back to the Builder Agent to attempt a fix.
🛠️ Installation
# Clone the repository
git clone https://github.com/yashghogre/Rivet.git
# Install dependencies (We use uv!)
uv sync
💻 Usage
1. Run the Generator
You can generate a full SDK or scope it to specific requirements.
uv run rivet https://petstore.swagger.io/v2/swagger.json
2. Output
The final package will be available in the ./output directory:
output/
├── client.py # The generated SDK
└── test_client.py # The test suite used to verify the code
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rivet_ai-0.2.0.tar.gz.
File metadata
- Download URL: rivet_ai-0.2.0.tar.gz
- Upload date:
- Size: 91.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
691b194b39858932dc5f62f05fe12b6b751f72d38fd1284d672c80b03ae1d236
|
|
| MD5 |
acc4e8646c0e4eb0b0d570507e14053b
|
|
| BLAKE2b-256 |
39f04f5a5c5891154d13dcdc7c555837ce3f7ab158b0b0fb7ffe2cace368d125
|
Provenance
The following attestation bundles were made for rivet_ai-0.2.0.tar.gz:
Publisher:
release.yml on yashghogre/Rivet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rivet_ai-0.2.0.tar.gz -
Subject digest:
691b194b39858932dc5f62f05fe12b6b751f72d38fd1284d672c80b03ae1d236 - Sigstore transparency entry: 768598744
- Sigstore integration time:
-
Permalink:
yashghogre/Rivet@bbbd925c69cfcd9cd428e03de57237ed0620275d -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/yashghogre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bbbd925c69cfcd9cd428e03de57237ed0620275d -
Trigger Event:
push
-
Statement type:
File details
Details for the file rivet_ai-0.2.0-py3-none-any.whl.
File metadata
- Download URL: rivet_ai-0.2.0-py3-none-any.whl
- Upload date:
- Size: 26.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
516295772ea820b67befd1dc4df0f32c71f40c30215da9e65173f68fdc91e2fd
|
|
| MD5 |
43937a89eb728be65e4551e9d5a58125
|
|
| BLAKE2b-256 |
940999fa72f23528d1ccb079567842da0ba898007fb557fbdc29cc25c46d4f78
|
Provenance
The following attestation bundles were made for rivet_ai-0.2.0-py3-none-any.whl:
Publisher:
release.yml on yashghogre/Rivet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rivet_ai-0.2.0-py3-none-any.whl -
Subject digest:
516295772ea820b67befd1dc4df0f32c71f40c30215da9e65173f68fdc91e2fd - Sigstore transparency entry: 768598746
- Sigstore integration time:
-
Permalink:
yashghogre/Rivet@bbbd925c69cfcd9cd428e03de57237ed0620275d -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/yashghogre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bbbd925c69cfcd9cd428e03de57237ed0620275d -
Trigger Event:
push
-
Statement type: