Execution libraries and test tools for Arazzo workflows and Open API operations
Project description
OAK Runner [Beta]
The OAK Runner is a workflow execution engine that processes and executes API workflows defined in the Arazzo format and individual API calls defined in OpenAPI specifications.
Usage
Execute a Workflow
from oak_runner import OAKRunner
runner = OAKRunner.from_arazzo_path("../../workflows/discord.com/workflows.arazzo.json")
result = runner.execute_workflow("workflowId", {"param1": "value1"})
Display Authentication Options
from oak_runner import OAKRunner
runner = OAKRunner.from_arazzo_path("../../workflows/discord.com/workflows.arazzo.json")
print(runner.get_env_mappings())
Execute a Single OpenAPI Operation
from oak_runner import OAKRunner
# Execute a single OpenAPI operation with an operationId
result = runner.execute_operation("operationId", {"param1": "value1"})
# Execute a single OpenAPI operation by path
result = runner.execute_operation("GET /users/@me/guilds", {"param1": "value1"})
Create a Runner with a Custom Base Path
# Create a runner instance with a custom base path for resolving OpenAPI file paths
runner_with_base_path = OAKRunner.from_arazzo_path(
"./my/arazzo.yaml",
base_path="./my/source/description/base"
)
Authentication
Credentials are resolved from environment variables defined by the OAK Runner based on the Arazzo or OpenAPI file. You can see the authentication options by using runner.get_env_mappings
or the show-env-mappings
command line tool defined below.
The OAK Runner supports various authentication methods defined in OpenAPI specifications:
- API Key: Header, Query, or Cookie API keys
- OAuth2: Some OAuth2 Flows (Client Credentials, Password)
- HTTP: Basic and Bearer Authentication
Auth Methods Not Yet Supported
- OAuth2: Authorization Code, Implicit
- OpenID: OpenID Connect
- Custom: Custom Authentication Schemes
Command Line Usage
Usage:
uvx oak-runner <command> [command-specific arguments] [global options]
Commands:
-
show-env-mappings
: Show environment variable mappings for authentication based on an Arazzo or OpenAPI file.uvx oak-runner show-env-mappings [arazzo_path | --openapi-path PATH]
arazzo_path
: Path to the Arazzo YAML file (use this OR --openapi-path).--openapi-path PATH
: Path to the OpenAPI spec file (use this OR arazzo_path). One of the path arguments is required.
-
execute-workflow
: Execute a workflow defined in an Arazzo file.uvx oak-runner execute-workflow <arazzo_path> --workflow-id <workflow_id> [--inputs <json_string>]
arazzo_path
: Required. Path to the Arazzo YAML file containing the workflow.--workflow-id WORKFLOW_ID
: Required. ID of the workflow to execute.--inputs INPUTS
: Optional JSON string of workflow inputs (default:{}
).
-
execute-operation
: Execute a single API operation directly from an OpenAPI specification (or an Arazzo file for context).uvx oak-runner execute-operation [--arazzo-path PATH | --openapi-path PATH] [--operation-id ID | --operation-path PATH_METHOD] [--inputs <json_string>]
--arazzo-path PATH
: Path to an Arazzo file (provides context, use this OR --openapi-path).--openapi-path PATH
: Path to the OpenAPI spec file (use this OR --arazzo-path). One of the path arguments is required.--operation-id ID
: TheoperationId
from the OpenAPI spec (use this OR --operation-path).--operation-path PATH_METHOD
: The HTTP method and path (e.g., 'GET /users/{id}') from the OpenAPI spec (use this OR --operation-id). One of the operation identifiers is required.--inputs INPUTS
: Optional JSON string of operation inputs (parameters, request body) (default:{}
).
-
list-workflows
: List all available workflows defined in an Arazzo file.uvx oak-runner list-workflows <arazzo_path>
arazzo_path
: Required. Path to the Arazzo YAML file.
-
describe-workflow
: Show details of a specific workflow, including its summary, inputs, steps, and outputs.uvx oak-runner describe-workflow <arazzo_path> --workflow-id <workflow_id>
arazzo_path
: Required. Path to the Arazzo YAML file containing the workflow.--workflow-id WORKFLOW_ID
: Required. ID of the workflow to describe.
-
generate-example
: Generate an example CLI command to execute a specified workflow, including placeholder inputs.uvx oak-runner generate-example <arazzo_path> --workflow-id <workflow_id>
arazzo_path
: Required. Path to the Arazzo YAML file containing the workflow.--workflow-id WORKFLOW_ID
: Required. ID of the workflow to generate an example for.
Global Options:
--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
: Set the logging level (default: INFO).
Examples:
# Show environment variable mappings using an Arazzo file
uvx oak-runner show-env-mappings ./tests/fixtures/discord/discord.arazzo.yaml
# Show environment variable mappings using an OpenAPI file
uvx oak-runner show-env-mappings --openapi-path ./tests/fixtures/discord/discord.openapi.json
# Execute a workflow
uvx oak-runner execute-workflow ./tests/fixtures/discord/discord.arazzo.yaml --workflow-id getUserInfoAndSendMessage --inputs '{\"recipient_id\": \"1234567890\", \"message_content\": \"Hello!\"}'
# Execute a specific operation using its operationId and an OpenAPI file
uvx oak-runner execute-operation --openapi-path ./tests/fixtures/discord/discord.openapi.json --operation-id list_my_guilds --inputs '{}'
# Execute a specific operation using its path/method and an Arazzo file (for context)
uvx oak-runner execute-operation --arazzo-path ./tests/fixtures/discord/discord.arazzo.yaml --operation-path 'GET /users/@me/guilds' --inputs '{}' --log-level DEBUG
# List all available workflows
uvx oak-runner list-workflows ./tests/fixtures/discord/discord.arazzo.yaml
# Describe a specific workflow
uvx oak-runner describe-workflow ./tests/fixtures/discord/discord.arazzo.yaml --workflow-id getUserInfoAndSendMessage
# Generate an example CLI command to execute a workflow
uvx oak-runner generate-example ./tests/fixtures/discord/discord.arazzo.yaml --workflow-id getUserInfoAndSendMessage
Help:
# General help
uvx oak-runner --help
# Help for a specific command (e.g., execute-operation)
uvx oak-runner execute-operation --help
Overview
OAK Runner orchestrates API workflows by:
- Loading and validating Arazzo workflow documents
- Executing workflow steps sequentially or conditionally
- Evaluating runtime expressions and success criteria
- Extracting and transforming data between steps
- Handling flow control (continue, goto, retry, end)
- Supporting nested workflow execution
- Providing event callbacks for workflow lifecycle events
- Managing authentication requirements across different APIs
Testing
The OAK Runner includes a comprehensive testing framework for workflow validation:
- Automated test fixtures for different workflow scenarios
- Mock HTTP responses based on OpenAPI specs
- Custom mock responses for specific endpoints
- Validation of workflow outputs and API call counts
For details on testing, see OAK Runner Testing Framework
Arazzo Format
The Arazzo specification is our workflow definition format that orchestrates API calls using OpenAPI specifications.
- Schema: arazzo-schema.yaml
- Documentation: arazzo-spec.md
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
File details
Details for the file oak_runner-0.8.6.tar.gz
.
File metadata
- Download URL: oak_runner-0.8.6.tar.gz
- Upload date:
- Size: 232.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 403ef2a9bf6208c5846eb276172e8366ecaa0f573de3dcffad8019d4013b5f2f |
|
MD5 | 634cf403a38767bb044ad06b1c0bcb51 |
|
BLAKE2b-256 | 2ccb83dcb1a6cf818f86631608209cfa8322b7a4420f2cd23c22295b76125b0e |
Provenance
The following attestation bundles were made for oak_runner-0.8.6.tar.gz
:
Publisher:
oak-runner-pypi.yaml
on jentic/oak
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
oak_runner-0.8.6.tar.gz
- Subject digest:
403ef2a9bf6208c5846eb276172e8366ecaa0f573de3dcffad8019d4013b5f2f
- Sigstore transparency entry: 215721909
- Sigstore integration time:
- Permalink:
jentic/oak@c5f1f07dade980b829d8c09dfddedd50db77b78e
- 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:
oak-runner-pypi.yaml@c5f1f07dade980b829d8c09dfddedd50db77b78e
- Trigger Event:
push
- Statement type:
File details
Details for the file oak_runner-0.8.6-py3-none-any.whl
.
File metadata
- Download URL: oak_runner-0.8.6-py3-none-any.whl
- Upload date:
- Size: 73.9 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 | 13d582ff77071afad6a0e1b365400807c38cdde2cbbc85df0cc0c87975128c3f |
|
MD5 | 5760276dd90ebddee0c4cd792810f7cc |
|
BLAKE2b-256 | 9c3a237136c0f74cf62198d27e34cd8a1e4db8cb97228f0c8edcad06d547f86f |
Provenance
The following attestation bundles were made for oak_runner-0.8.6-py3-none-any.whl
:
Publisher:
oak-runner-pypi.yaml
on jentic/oak
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
oak_runner-0.8.6-py3-none-any.whl
- Subject digest:
13d582ff77071afad6a0e1b365400807c38cdde2cbbc85df0cc0c87975128c3f
- Sigstore transparency entry: 215721911
- Sigstore integration time:
- Permalink:
jentic/oak@c5f1f07dade980b829d8c09dfddedd50db77b78e
- 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:
oak-runner-pypi.yaml@c5f1f07dade980b829d8c09dfddedd50db77b78e
- Trigger Event:
push
- Statement type: