Tool for analyzing OpenAPI specifications and generating meaningful Arazzo workflows by identifying logical API sequences and patterns.
Project description
Arazzo Generator [Beta]
A tool for analyzing OpenAPI specifications and generating meaningful Arazzo workflows by identifying logical API sequences and patterns.
Overview
The Jentic Arazzo Generator transforms OpenAPI specifications into Arazzo workflows, facilitating the creation of well-structured, user-centric API sequences. It employs LLM-powered intelligence to identify workflows that represent real-world use cases and valuable user journeys.
Arazzo is a workflow specification that describes sequences of API calls and their dependencies to achieve specific outcomes. The generated workflows improve API documentation by showing developers not just individual endpoints, but meaningful sequences that accomplish complete business tasks.
Join our community! Connect with contributors and users on Discord to discuss ideas, ask questions, and collaborate on the Jentic Arazzo Generator repository.
Getting started
Assuming that you have a supported version of Python installed, you can first set up your environment with:
python -m venv .venv
...
source .venv/bin/activate
Then, you can install arazzo-generator from PyPI with:
python -m pip install arazzo-generator
Command Line Usage
Make sure you have the Arazzo Generator installed and activated in your virtual environment.
arazzo-generator command will be available after installation.
Generate an Arazzo Workflow
To generate an Arazzo workflow specification from an OpenAPI file using LLM-based analysis:
arazzo-generator generate <openapi_file_path> -o <output_file_path>
Example:
arazzo-generator generate /path/to/openapi.yaml -o ./output.yaml --format yaml
You can also generate output in JSON format (default):
arazzo-generator generate /path/to/openapi.yaml -o ./output.json --format json
Or use the shorter option flag:
arazzo-generator generate /path/to/openapi.yaml -o ./output.json -f json
Run arazzo-generator generate --help for more options.
Generating files in batches is possible using the batch command. Run arazzo-generator batch --help for more options.
Validate an Arazzo Workflow
To validate an existing Arazzo specification in either YAML or JSON format:
arazzo-generator validate /path/to/arazzo.yaml
# OR
arazzo-generator validate /path/to/arazzo.json
The validator automatically detects the format based on the file extension.
Key Features
- OpenAPI Parser: Robust parsing of OpenAPI v3.0 and v3.1 specifications with extensive error handling
- LLM-Powered Workflow Analysis:
- Intelligent identification of workflows
- Context-aware discovery of meaningful API sequences
- Natural language descriptions of workflow purposes
- Arazzo Generator: Creates compliant Arazzo specifications from identified workflows
- Arazzo Validator: Ensures generated specifications adhere to the Arazzo schema
Architecture
Core Components
1. OpenAPI Parser (openapi_parser.py)
- Fetches and parses OpenAPI specifications from URLs or local files (OpenAPI v3.0 and v3.1)
- Uses prance for parsing and validation (https://pypi.org/project/prance/)
- Provides robust error handling for imperfect real-world specifications
- Extracts endpoints, schemas, and metadata for further analysis
2. Workflow Analyzer (llm_analyzer.py)
- LLM Integration:
- Workflow identification with contextual understanding and LLM-powered analysis
- Workflow validation and filtering
3. LLM Service (llm/litellm_service.py)
- Connects to LLMs for intelligent analysis
- Supports multiple LLM providers (e.g., OpenAI, Anthropic, Gemini) using LiteLLM
- Uses carefully crafted prompts for endpoint analysis and workflow validation
- Processes and cleans API responses for reliable integration
4. Arazzo Generator (arazzo_generator.py)
- Transforms identified workflows into valid Arazzo specifications
- Creates structured step sequences with appropriate parameters and outputs
- Handles formatting and encoding for compliance with Arazzo schema
5. Arazzo Validator (arazzo_validator.py)
- Validates generated specifications against the Arazzo schema
- Provides detailed error messages for troubleshooting
- Supports validation from local files, URLs, or embedded schema
6. Command-Line Interface (cli/main.py)
- Provides a user-friendly interface for generation and validation
- Supports customization of LLM settings and output formats
- Includes comprehensive logging for visibility into the process
Development
All following sections assume that you're inside the ./generator directory of the arazzo-engine monorepo.
Installation
-
Install PDM if you haven't already:
# Install PDM curl -sSL https://pdm.fming.dev/install-pdm.py | python3 - # Or with Homebrew (macOS/Linux) brew install pdm # Or with pip pip install pdm
-
Install project dependencies:
# Install dependencies pdm install
Configuration
Method 1: Using Environment File (Recommended)
-
Copy the example environment file:
cp .env.example .env
-
Edit the
.envfile with your preferred text editor and add your API keys:# Example .env file GEMINI_API_KEY=your_gemini_key_here ANTHROPIC_API_KEY=your_anthropic_key_here OPENAI_API_KEY=your_openai_key_here
Method 2: Using Shell Environment Variables
You can set the API keys directly in your shell session:
# For current session only
export GEMINI_API_KEY=your_gemini_key_here
export ANTHROPIC_API_KEY=your_anthropic_key_here
export OPENAI_API_KEY=your_openai_key_here
Usage
Basic Usage
To generate an Arazzo workflow specification from an OpenAPI file using LLM-based analysis:
pdm run generate <openapi_file_path> -o <output_file_path>
Example:
pdm run generate /path/to/openapi.yaml -o ./output.yaml --format yaml
You can also generate output in JSON format (default):
pdm run generate /path/to/openapi.yaml -o ./output.json --format json
Or use the shorter option flag:
pdm run generate /path/to/openapi.yaml -o ./output.json -f json
Validation
To validate an existing Arazzo specification in either YAML or JSON format:
pdm run validate /path/to/arazzo.yaml
# OR
pdm run validate /path/to/arazzo.json
The validator automatically detects the format based on the file extension.
Docker
The project includes Docker configurations for both the API server and CLI tool modes, making it easy to deploy to environments like AWS ECS.
Quick Start with Docker
# Build the Docker image
docker build -t arazzo-generator -f docker/Dockerfile .
# Run the API server
docker run -p 8000:8000 \
-e ANTHROPIC_API_KEY=your_api_key \
-e OPENAI_API_KEY=your_api_key \
-e GEMINI_API_KEY=your_api_key \
arazzo-generator
# Run the CLI tool
mkdir output
docker run --rm \
-e ANTHROPIC_API_KEY=your_api_key \
-e OPENAI_API_KEY=your_api_key \
-e GEMINI_API_KEY=your_api_key \
-v $(pwd)/output:/app/output \
arazzo-generator python -m arazzo_generator generate <url> --output /app/output/result.yaml
For detailed Docker instructions including AWS ECS deployment, see the Docker README.
Running the API Server locally
# Run the API server
pdm run uvicorn arazzo_generator.api.app:app --host 0.0.0.0 --port 8000
Issue a POST request to the /generate endpoint with the following payload:
curl -s -X POST "http://localhost:8000/generate" \
-H "Content-Type: application/json" \
-d '{
"url": "https://raw.githubusercontent.com/jentic/jentic-public-apis/refs/heads/main/apis/openapi/yelp.com/main/1.0.0/openapi.json",
"format": "json",
"validate_spec": true,
"enable_llm": true,
"llm_provider": "gemini"
}' | jq -r '.arazzo_spec' | jq '.' > arazzo_spec.json
Running Tests
# Run all tests
pdm run test
# Run a specific test file
pdm run test tests/parser/test_openapi_parser.py
Code Formatting & Linting
The project uses black, isort and ruff for code formatting.
# Check formatting & linting without making changes
pdm run lint
# Format & lint code
pdm run lint:fix
Available PDM Scripts
pdm run generate- Generate Arazzo workflows from OpenAPI specspdm run validate- Validate Arazzo workflow filespdm run batch- Batch processes multiple OpenAPI specs to generate Arazzo workflowspdm run test- Run all testspdm run lint- Check formatting & linting without making changespdm run lint:fix- Format & lint code
LLM Configuration
You can configure the LLM provider and model in the config.toml file:
[llm]
# Example supported providers: "gemini", "openai", "anthropic"
llm_provider = "gemini"
# Recommended model to use due to Gemini's large context window
llm_model = "gemini/gemini-2.0-flash"
Logging Configuration
The application uses a centralized logging system configured via the config.toml file in the project root. This system handles both application logs and LLM interaction logs (prompts and responses).
Configurable Options
You can customize the following logging settings in config.toml:
[logging]
# Log format using standard Python logging format strings
format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
# Output destinations: "console", "file", or both
destinations = ["console", "file"]
# Default log level: DEBUG, INFO, WARNING, ERROR, CRITICAL
level = "INFO"
# File logging configuration
[logging.file]
log_dir = "logs" # Directory for log files
filename = "jentic.log" # Application log filename
Log Directory Structure
Logs are stored in timestamped directories under the logs folder:
logs/
└── 20250725_104937/ # Timestamped directory for each run
├── jentic.log # Application logs
├── workflow_analysis_prompt.txt # LLM prompts
└── workflow_analysis_response.txt # LLM responses
This unified structure ensures all logs from a single execution (both application logs and LLM interactions) are stored together in the same directory.
Integration with jentic-public-apis
This Arazzo Generator powers the automated workflow generation in the jentic-public-apis repository. To generate an Arazzo specification from an OpenAPI spec:
- Create a new 'Generate Arazzo Specification...' issue in the jentic-public-apis repository
- Include the URL pointing to your OpenAPI specification (must be publicly accessible)
- Optionally, specify any specific workflows you'd like to generate
The system will automatically process your request and generate the corresponding Arazzo specification. You'll be notified when the generation is complete.
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
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 arazzo_generator-0.1.2.tar.gz.
File metadata
- Download URL: arazzo_generator-0.1.2.tar.gz
- Upload date:
- Size: 76.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04ea74cf4f3db4c7cf66ea55eddb95918dc2fcbf216e2cec9fea6dd73a7aee49
|
|
| MD5 |
2949a0c91e56a0353ea76610d6968ae5
|
|
| BLAKE2b-256 |
3f314472a111c624ef5d0072ae29256ce4544fc7a813b74a57c07a294cb41017
|
Provenance
The following attestation bundles were made for arazzo_generator-0.1.2.tar.gz:
Publisher:
arazzo-generator-pypi.yaml on jentic/arazzo-engine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arazzo_generator-0.1.2.tar.gz -
Subject digest:
04ea74cf4f3db4c7cf66ea55eddb95918dc2fcbf216e2cec9fea6dd73a7aee49 - Sigstore transparency entry: 458412886
- Sigstore integration time:
-
Permalink:
jentic/arazzo-engine@794d13e1b82e0d0004cc6185814f216b11e99ea7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jentic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
arazzo-generator-pypi.yaml@794d13e1b82e0d0004cc6185814f216b11e99ea7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file arazzo_generator-0.1.2-py3-none-any.whl.
File metadata
- Download URL: arazzo_generator-0.1.2-py3-none-any.whl
- Upload date:
- Size: 90.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4f282c3f95dd8d5cb3b1e01388b54e40e694a94927211a94b9f8dc46ea44ec4
|
|
| MD5 |
e7fd918dce0a3a2e215c3feee9cb9b1f
|
|
| BLAKE2b-256 |
e08b02639327bfd5f5b6b67faa964b342da83b1344ea43da70edacd1efd6c96a
|
Provenance
The following attestation bundles were made for arazzo_generator-0.1.2-py3-none-any.whl:
Publisher:
arazzo-generator-pypi.yaml on jentic/arazzo-engine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arazzo_generator-0.1.2-py3-none-any.whl -
Subject digest:
c4f282c3f95dd8d5cb3b1e01388b54e40e694a94927211a94b9f8dc46ea44ec4 - Sigstore transparency entry: 458412889
- Sigstore integration time:
-
Permalink:
jentic/arazzo-engine@794d13e1b82e0d0004cc6185814f216b11e99ea7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jentic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
arazzo-generator-pypi.yaml@794d13e1b82e0d0004cc6185814f216b11e99ea7 -
Trigger Event:
push
-
Statement type: