Skip to main content

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 < 5)" --> FixSDK
    Analyze -- "Is SDK Error? (Retry >= 5)" --> Fail
    Analyze -- "Is Test Error? (Retry < 5)" --> FixTests
    Analyze -- "Is Test Error? (Retry >= 5)" --> 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.

  1. The code is injected into an isolated Docker Container.

  2. pytest is executed.

  3. If tests pass: The SDK is packaged and delivered to you.

  4. If tests fail: The Error Analyzer captures the stderr output, diagnoses the crash (e.g., ImportError, ValidationError), and feeds this feedback back to the Builder Agent to attempt a fix.

🛠️ Installation

You can install Rivet directly from PyPI or build it from source.

Option 1: Standard Installation (Recommended)

pip install rivet-ai

Option 2: Development Installation If you want to contribute or modify the source code:

git clone https://github.com/yashghogre/Rivet.git

cd Rivet

uv sync

💻 Usage

1. Run the Generator

Point Rivet at any OpenAPI/Swagger URL to generate a client.

If installed via pip:

rivet https://petstore.swagger.io/v2/swagger.json

or simply,

rivet

If running from source:

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rivet_ai-0.2.1.tar.gz (91.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rivet_ai-0.2.1-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file rivet_ai-0.2.1.tar.gz.

File metadata

  • Download URL: rivet_ai-0.2.1.tar.gz
  • Upload date:
  • Size: 91.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rivet_ai-0.2.1.tar.gz
Algorithm Hash digest
SHA256 4f5126d9f7545740ac943f4ce89b0f952f6da60c78d0d5f0df9ee3bf43d8c86b
MD5 db67267d4846da2f56dbe845ea7df928
BLAKE2b-256 f18194b9d47400580714bec766e026ce3e8a71d9b91cc9150d750407df5e0d2d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rivet_ai-0.2.1.tar.gz:

Publisher: release.yml on yashghogre/Rivet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rivet_ai-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: rivet_ai-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 26.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rivet_ai-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 65d3fe48cba221eb41f255532afc083ab09a9a32e6a69030109edfc45b46c425
MD5 20947a8f00477348f693d4d02218ea2f
BLAKE2b-256 f76b2243f31ae06c58a3113a8377c4e6953676c2c7d7478bbd7f6c5bf996ad05

See more details on using hashes here.

Provenance

The following attestation bundles were made for rivet_ai-0.2.1-py3-none-any.whl:

Publisher: release.yml on yashghogre/Rivet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page