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
subgraph Stage1["Stage 1: The Architect (Analysis)"]
User[User Input] -->|URL + 'I need payments'| Slicer[Spec Slicer Node]
DocSource[OpenAPI URL] -->|Fetch JSON| Slicer
Slicer -->|Graph Traversal| MiniSpec[Mini-Spec JSON]
Docs[HTML Docs] -->|Scrape| RAG[Graph State]
end
subgraph Stage2["Stage 2: The Builder (Generation)"]
MiniSpec -->|Context| Agent[LangGraph Coding Agent]
RAG -->|Context| Agent
Agent -->|Generate| ClientCode["client.py"]
Agent -->|Generate| TestCode["test_integration.py"]
end
subgraph Stage3["Stage 3: The Auditor (Verification)"]
ClientCode -->|Inject| Docker[Docker Container]
TestCode -->|Inject| Docker
Docker -->|Run Pytest| Result{Pass or Fail?}
Result -->|Fail with Stderr| ErrorParser[Error Analyzer]
ErrorParser -->|Feedback + Logs| Agent
Result -->|Pass| Package[Final SDK Package]
end
style Agent fill:#800,stroke:#333,stroke-width:2px
style Docker fill:#003f5c,stroke:#fff,stroke-width:2px,color:#fff
style ErrorParser fill:#bc5090,stroke:#333,stroke-width:2px,color:#fff
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.1.0.tar.gz.
File metadata
- Download URL: rivet_ai-0.1.0.tar.gz
- Upload date:
- Size: 72.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3fa9dc212e96d07be7af3f75fd2f9aba366582b968a507b4e0de72c635994c6
|
|
| MD5 |
645022784140aecc98e860908515e547
|
|
| BLAKE2b-256 |
659099cd3f929bc233706417a83f94dca8d6a2c06613b5f7904f28359492ae21
|
File details
Details for the file rivet_ai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rivet_ai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cb4118ba5ca36880d81d976147f16a29548daa06f6ca2b5cd296e25e9c6f802
|
|
| MD5 |
db2b1e28fdcdde8cca54cd99c49744b5
|
|
| BLAKE2b-256 |
859c52f00917c3f712862e18a45328bf1ed2a6915cee5107891fe96de0768944
|