rickphp/laravel-rick

Durable, tenant-aware AI workflow compilation and execution for Laravel

Maintainers

Package info

github.com/para1992/laravel-rick

pkg:composer/rickphp/laravel-rick

Transparency log

Statistics

Installs: 14

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v0.2.0 2026-08-14 21:21 UTC

This package is auto-updated.

Last update: 2026-08-14 21:27:16 UTC


README

Durable AI workflows for Laravel.

Laravel Rick turns typed workflow definitions into recoverable, tenant-aware runs. It supports synchronous and queued execution, Laravel AI calls, manual review and input, encrypted persistence, budgets, metrics, recovery, and a transactional outbox.

Laravel Rick durable workflow demo

Demo

Run the human-in-the-loop demo to generate five candidates, pause for a human decision, and continue with the selected result. It is free and deterministic by default, with an optional live Laravel AI provider mode.

Installation

Laravel Rick requires PHP 8.3+ and Laravel 12 or 13.

composer require rickphp/laravel-rick:^0.1
php artisan migrate

Provider setup

For OpenRouter, add your key and model to .env:

OPENROUTER_API_KEY=your-key-here
RICK_LLM_PROVIDER=openrouter
RICK_LLM_MODEL=google/gemini-3.5-flash-lite

Publish the package configuration:

php artisan vendor:publish --tag=rick-config

Then route the medium tier in config/rick.php:

'medium' => [
    'provider' => env('RICK_LLM_PROVIDER', 'openrouter'),
    'model' => env('RICK_LLM_MODEL'),
],

After changing .env or configuration, run php artisan config:clear.

Laravel Rick routes through every text provider supported by the installed Laravel AI SDK. With Laravel AI 0.10, that includes OpenAI, OpenAI Compatible, Anthropic, Gemini, Azure OpenAI, Amazon Bedrock, Groq, xAI, DeepSeek, Mistral, Ollama, and OpenRouter. Structured workflows also require a selected model that supports structured output. OpenRouter is live-tested by this package; Gemini structured schemas are covered by regression fixtures. Other providers use the same adapter but are not yet live-tested by the package.

See Installation and configuration for all model tiers, provider credentials, cost notes, and troubleshooting. Laravel AI maintains the current provider support matrix.

Quick start

After configuring a Laravel AI provider and model, run a prompt as a durable workflow:

use Rick\Laravel\Rick;

$rick = app(Rick::class);

$workflow = $rick->workflow('summary')
    ->rawPrompt('Summarize the latest customer feedback.')
    ->build();

$run = $rick->run($workflow);

echo $run->output();

Longer workflows can generate candidates, pause for human input, run in parallel, enforce quality gates, verify grounding, and resume through queues.

Typical tasks

The examples below assume $rick = app(Rick::class).

Generate content within a fixed budget

$workflow = $rick->workflow('product-description')
    ->budget(maxCostUsd: '0.10')
    ->resolve('Write a product description.', 'A concise description is ready.')
    ->context('product')
    ->generate('description', outputKey: 'description')
    ->outputGlue('description')
    ->build();

$run = $rick->run($workflow, ['product' => $product]);

Process a list through queues

$workflow = $rick->workflow('ticket-summaries')
    ->resolve('Summarize every support ticket.', 'Every ticket has a summary.')
    ->context('tickets')
    ->map('tickets', 'items', 'rick.text', 'summaries', maxItems: 100)
    ->outputGlue('summaries')
    ->build();

$run = $rick->schedule($workflow, ['tickets' => ['items' => $tickets]]);

Generate variants and let a person choose

$workflow = $rick->workflow('campaign-copy')
    ->resolve('Write campaign copy.', 'Three distinct drafts are ready.')
    ->draft(candidates: 3)
    ->manualJudge()
    ->outputGlue('draft')
    ->build();

$run = $rick->run($workflow);
$review = $rick->pendingReview($run->id);
$rick->selectCandidate($run->id, $review->candidates[0]->id);

Verify an answer against supplied evidence

$workflow = $rick->workflow('grounded-answer')
    ->resolve('Answer the question from the evidence.', 'Every claim is grounded.')
    ->context('question')
    ->context('evidence')
    ->generate('answer', outputKey: 'answer', reads: ['question', 'evidence'])
    ->groundedVerify('answer', ['evidence'], output: 'verified')
    ->outputGlue('verified')
    ->build();

$run = $rick->run($workflow, compact('question', 'evidence'));

Documentation

Testing

composer qa

Project