Practical Real-World Use Cases
This guide walks you through five comprehensive real-world scenarios using LaraOrcest, demonstrating how to leverage its multi-agent capabilities, safety guardrails, proxy routing, and documentation generators.
Use Case 1: End-to-End Laravel Feature Delivery
Context & Objective
Your team needs a new Customer Feedback & Rating API in an existing Laravel application. The feature requires:
- A database migration creating the
feedbackstable with columns:id,user_id(foreign key nullable for guests),rating(integer 1-5),comment(text nullable),status(enum:pending,approved,rejected), timestamps. - An Eloquent
Feedbackmodel with proper casts, fillable attributes, and scopes. - A
StoreFeedbackRequestform request validating that ratings are between 1 and 5 and comments do not exceed 1,000 characters. - A
FeedbackControllerwithstore(public) andindex(admin moderation) endpoints. - Route registration in
routes/api.php. - Complete Pest or PHPUnit automated feature tests.
- Comprehensive OpenAPI 3.0+ documentation in
docs/swagger.json. - Automatic Git feature branch creation and milestone commit.
Execution Command
php artisan orcest:build "Create a customer feedback API with rating (1-5), optional comments, and an admin moderation endpoint" --swagger --swagger-format=jsonAgent Progression & Execution Trace
business_analyst:- Evaluates domain requirements.
- Identifies business invariants (ratings must be strictly 1-5; guest feedback is permitted; moderation status defaults to
pending). - Writes
requirements_spec.
product_manager:- Decomposes requirements into 3 prioritized tasks:
task_1: Database migration andFeedbackmodel.task_2: Form Request, API Controller, and Route bindings.task_3: Feature test suite and validation edge cases.
- Decomposes requirements into 3 prioritized tasks:
architect:- Generates technical architecture blueprint mapping tasks to standard Laravel paths.
git_agent:- Verifies clean Git tree on
main. - Creates and checks out branch
orcest/customer-feedback-api.
- Verifies clean Git tree on
database_agent:- Invokes
ArtisanRunnerToolto runmake:migration create_feedbacks_table. - Uses
PatchWriterToolto write migration schema andapp/Models/Feedback.php.
- Invokes
backend_agent:- Generates
app/Http/Requests/StoreFeedbackRequest.php. - Generates
app/Http/Controllers/FeedbackController.php. - Registers
Route::apiResource('feedback', FeedbackController::class);inroutes/api.php.
- Generates
swagger_agent:- Analyzes routes, form request rules, and controller response structures.
- Generates
docs/swagger.jsonconforming to OpenAPI 3.0.3 with complete schemas, request body samples, and 201/422 response schemas.
qa_agent:- Writes
tests/Feature/FeedbackApiTest.phpcovering valid submissions, validation failures for ratings > 5, and admin authorization. - Runs
TestRunnerTool(php artisan test --without-tty). - Tests pass: 4 passed, 10 assertions.
- Writes
reviewer_agent:- Inspects
git diffagainst PSR-12 and Laravel best practices. - Issues
APPROVEDdecision with zero security findings.
- Inspects
Finalization (
GraphEngine):- Stages all generated artifacts.
- Commits milestone to
orcest/customer-feedback-api:feat(orcest): implement Create a customer feedback API.... - Updates
.lara-orcest/memory.jsonwith indexedFeedbackmodel and architectural decision.
Expected Artifacts
database/migrations/2026_01_01_create_feedbacks_table.php
app/Models/Feedback.php
app/Http/Requests/StoreFeedbackRequest.php
app/Http/Controllers/FeedbackController.php
docs/swagger.json
tests/Feature/FeedbackApiTest.phpUse Case 2: Two-Site Web Scraping & Ingestion Pipeline
Context & Objective
You need to extract product pricing and availability data from two vendor websites, compare and normalize the schemas based on your business rules, and dispatch the unified payload to your internal catalog ingestion webhook (https://api.mycompany.test/webhooks/vendor-catalog).
The scraping must strictly follow:
- Extraction guided by
business_analystinvariants andproduct_manageracceptance criteria. - Scheme and IP safety (no access to internal/private IPs without explicit authorization).
- Preview safety using
--dry-runto inspect extracted payloads before sending live network requests.
Step 1: Previewing with --dry-run
Test the extraction and normalization without sending HTTP requests to the target endpoint:
php artisan orcest:build "Scrape vendor pricing from https://vendor-alpha.example.com/product/123 and https://vendor-beta.example.com/item/456 and dispatch unified catalog payload to https://api.mycompany.test/webhooks/vendor-catalog" --dry-runWhat Happens in Dry-Run:
business_analystspecifies required fields:sku,price,currency,in_stock,vendor_name.product_managerdrafts mapping criteria reconciling price formats and currency symbols.web_scraping_agent:- Fetches both URLs within safety limits (capped at 500KB response size, 10,000 characters prompt context).
- Generates
site_1_data,site_2_data, andunified_payload. - Records the dispatch action as
preview. - Writes structured preview to
artifacts:web_scraping/payload.json.
- The terminal displays the unified payload and extraction summary with zero live side-effects.
Step 2: Executing the Live Scraping Pipeline
Once verified, execute the live dispatch:
php artisan orcest:build "Scrape vendor pricing from https://vendor-alpha.example.com/product/123 and https://vendor-beta.example.com/item/456 and dispatch unified catalog payload to https://api.mycompany.test/webhooks/vendor-catalog"Resulting Output in RunState & Artifacts
The payload is dispatched via HTTP POST to the target endpoint, and the run records the following in $state->metadata['web_scraping']:
{
"source_urls": [
"https://vendor-alpha.example.com/product/123",
"https://vendor-beta.example.com/item/456"
],
"target_endpoint": "https://api.mycompany.test/webhooks/vendor-catalog",
"http_method": "POST",
"extraction_summary": "Extracted SKU 123 from Vendor Alpha ($49.99, In Stock) and SKU 456 from Vendor Beta ($52.00, In Stock). Normalized to USD.",
"unified_payload": {
"normalized_sku": "SKU-PROD-123",
"lowest_price": 49.99,
"currency": "USD",
"sources": [
{ "vendor": "Alpha", "price": 49.99, "available": true },
{ "vendor": "Beta", "price": 52.00, "available": true }
],
"timestamp": "2026-11-22T20:30:00Z"
},
"dispatch": {
"status_code": 200,
"successful": true
}
}Use Case 3: Multi-Model Routing via LLM Proxy (LiteLLM)
Context & Objective
Running all tasks on top-tier reasoning models (like claude-3-5-sonnet or o3-mini) can be prohibitively expensive. Conversely, small models often produce flawed architectural decisions and overlook security edge cases.
In this use case, we configure heterogeneous per-agent model routing through a local or centralized LiteLLM Proxy:
- Frontier Reasoning Models (
claude-3-5-sonnet): Forarchitect,reviewer_agent, andfixer_agent. - Fast / Cost-Effective Models (
gpt-4o-mini): For routine authoring indatabase_agent,backend_agent,git_agent, andswagger_agent.
Step 1: Start LiteLLM Proxy
Create a litellm-config.yaml file (see examples/litellm-config.yaml) and start LiteLLM:
litellm --config examples/litellm-config.yaml --port 4000Step 2: Configure Laravel .env
Point LaraOrcest to the LiteLLM proxy endpoint and configure per-agent model routing:
# Point to LiteLLM Proxy
LARA_ORCEST_LLM=openai_compatible
LARA_ORCEST_LLM_BASE_URL=http://127.0.0.1:4000/v1
LARA_ORCEST_LLM_API_KEY=sk-litellm-secret-key
# Default fallback model
LARA_ORCEST_LLM_MODEL=gpt-4o-mini
# Analytical & Reasoning Roles -> High-tier reasoning
LARA_ORCEST_MODEL_BUSINESS_ANALYST=claude-3-5-sonnet
LARA_ORCEST_MODEL_PRODUCT_MANAGER=gpt-4o
LARA_ORCEST_MODEL_ARCHITECT=claude-3-5-sonnet
LARA_ORCEST_MODEL_REVIEWER_AGENT=claude-3-5-sonnet
LARA_ORCEST_MODEL_FIXER_AGENT=claude-3-5-sonnet
# Routine Code Generation -> Fast & cheap
LARA_ORCEST_MODEL_GIT_AGENT=gpt-4o-mini
LARA_ORCEST_MODEL_DATABASE_AGENT=gpt-4o-mini
LARA_ORCEST_MODEL_BACKEND_AGENT=gpt-4o-mini
LARA_ORCEST_MODEL_SWAGGER_AGENT=gpt-4o-mini
LARA_ORCEST_MODEL_QA_AGENT=gpt-4o-miniStep 3: Run Orchestration
Run any feature prompt:
php artisan orcest:build "Add two-factor recovery codes generation endpoint"Outcome & Benefits
- High-level architecture and final security audits are performed by Claude 3.5 Sonnet.
- Eloquent migrations, standard boilerplate, and Swagger documentation are generated by GPT-4o Mini.
- Result: ~70% reduction in token costs with zero degradation in code quality or architectural rigor.
Use Case 4: Human-in-the-Loop Approval vs. Unattended Execution
Scenario A: Interactive Developer Review (--interactive)
When working on core domain logic, you want to review the database schema and technical plan before the agent starts writing code.
1. Start Interactive Execution
php artisan orcest:build "Add subscription billing with Stripe webhook handlers" --interactive2. Gate Triggered (after_plan)
Execution runs through business_analyst, product_manager, and architect, then halts:
[Step 1] business_analyst ............. Requirements specification drafted
[Step 2] product_manager .............. Backlog with 4 tasks prioritized
[Step 3] architect .................... Technical plan generated
⏸ LaraOrcest paused for human review at gate: [after_plan] [Run ID: run_67e1ff9801a]
Review Summary: Technical plan and backlog generated. Paused for human plan approval.
Planned Tasks: 4 tasks
To approve and resume execution:
php artisan orcest:approve run_67e1ff9801a3. Inspecting the Proposal
Check the detailed state of the run before deciding:
php artisan orcest:status run_67e1ff9801a4. Approving the Plan
Resume execution:
php artisan orcest:approve run_67e1ff9801a --note="Approved schema and webhook signature validation"The run resumes seamlessly, executes git_agent, database_agent, backend_agent, and qa_agent. If before_commit gate is enabled, it pauses once more for a final review before committing to Git.
Scenario B: Unattended CI/CD Automation (--no-human-review)
In continuous integration pipelines or overnight batch jobs, human review is impossible. You need the agent to run autonomously, relying on automated tests and the reviewer_agent audit to decide completion.
1. Run Unattended
php artisan orcest:build "Create healthcheck status endpoint returning redis, db, and cache status" --no-human-review2. Execution Behavior:
- All Human-in-the-Loop review gates (
after_plan,before_commit) are bypassed. - If automated tests fail,
fixer_agentattempts repairs up tomax_fix_attempts(default: 3). - If tests pass and
reviewer_agentapproves, changes are automatically committed to the feature branch. - If tests fail after 3 attempts, the command exits with code
1(failing the CI build step).
Use Case 5: Multi-Vendor / Multi-Tenant Platform using Domain-Driven Design (DDD)
Context & Architecture Goal
Your engineering team is architecting an enterprise Multi-Vendor Marketplace & SaaS Core in Laravel. Unlike standard CRUD applications, this system requires strict Domain-Driven Design (DDD) layered boundaries and absolute multi-tenant data isolation:
- Three Bounded Contexts:
TenancyContext: Vendor onboarding, tenant provisioning, lifecycle management (pending,active,suspended), and tenant resolution middleware (TenantResolverMiddleware) resolving active tenant context viaX-Tenant-IDheader or authenticated vendor sessions.CatalogContext: Vendor-managed product catalog, inventory tracking, and SKU uniqueness scoped strictly per tenant.OrdersContext: Customer checkout supporting multi-vendor carts, anOrderSplitterdomain service that splits line items into vendor-specific sub-orders, and commission calculations.
- Strict Multi-Tenant Invariants:
- Every operational entity (
products,inventory,orders,order_items) must be scoped by an indexedtenant_id. - Global Eloquent
TenantScopemust automatically apply to all catalog and order queries. - Cross-tenant access attempts (e.g. Vendor A attempting to inspect or modify Vendor B's inventory) must fail with
404 Not Foundto prevent leaking entity existence.
- Every operational entity (
- Domain-Driven Directory Layout:
- Code must be organized by Bounded Context under
app/Domains/{Tenancy,Catalog,Orders}/with isolated layers:Domain/(entities, value objects, domain events, repository interfaces),Application/(use-case actions, DTOs),Infrastructure/(Eloquent models, repositories, database migrations), andInterfaces/Http/(controllers, requests, resources).
- Code must be organized by Bounded Context under
Recommended Model Routing (llm.agent_models)
Domain-Driven Design and multi-tenant security demand rigorous architectural reasoning. Generic LLMs often leak framework dependencies into the Domain layer or forget global tenant scopes.
We configure high-reasoning frontier models for analytical and auditing agents, while routing routine code authoring and testing to fast models:
# High-reasoning models: Architecture, invariants, and staff audit
LARA_ORCEST_MODEL_BUSINESS_ANALYST=claude-3-5-sonnet-20241022
LARA_ORCEST_MODEL_PRODUCT_MANAGER=gpt-4o
LARA_ORCEST_MODEL_ARCHITECT=claude-3-5-sonnet-20241022
LARA_ORCEST_MODEL_REVIEWER_AGENT=claude-3-5-sonnet-20241022
# Cost-effective models: Routine migrations, models, and controllers
LARA_ORCEST_MODEL_DATABASE_AGENT=gpt-4o-mini
LARA_ORCEST_MODEL_BACKEND_AGENT=gpt-4o-mini
LARA_ORCEST_MODEL_SWAGGER_AGENT=gpt-4o-mini
LARA_ORCEST_MODEL_GIT_AGENT=gpt-4o-mini
# Dedicated coding & debugging models
LARA_ORCEST_MODEL_QA_AGENT=gpt-4o
LARA_ORCEST_MODEL_FIXER_AGENT=claude-3-5-sonnet-20241022Step-by-Step Agent Flow
┌────────────────────────────────────────┐
│ business_analyst │
│ (Extracts tenant isolation rules, │
│ order-splitting & boundary invariants)│
└───────────────────┬────────────────────┘
│
▼
┌────────────────────────────────────────┐
│ product_manager │
│ (Partitions into 4 tasks with │
│ depends_on & scope_paths metadata) │
└───────────────────┬────────────────────┘
│
▼
┌────────────────────────────────────────┐
│ architect │
│ (Designs DDD directory structure, │
│ Value Objects, Actions & TenantScope)│
└───────────────────┬────────────────────┘
│
[after_plan Gate]
(Paused for HITL)
│
▼
┌────────────────────────────────────────┐
│ git_agent │
│ (Creates orcest/multi-vendor-ddd-core)│
└───────────────────┬────────────────────┘
│
┌───────────────────┴────────────────────┐
│ Parallel Wave Scheduling │
│ Wave 0: Tenancy Core │
│ Wave 1: Catalog & Orders Contexts │
└───────────────────┬────────────────────┘
│
▼
┌────────────────────────────────────────┐
│ database & backend agents │
│ (Authors migrations, Eloquent models, │
│ actions, requests, and controllers) │
└───────────────────┬────────────────────┘
│
▼
┌────────────────────────────────────────┐
│ swagger_agent │
│ (Generates OpenAPI spec with │
│ X-Tenant-ID header security scheme) │
└───────────────────┬────────────────────┘
│
▼
┌────────────────────────────────────────┐
│ qa_agent │
│ (Writes cross-tenant isolation tests &│
│ executes php artisan test) │
└───────────────────┬────────────────────┘
│
[Tests Passing?]
├── No ──► fixer_agent (patches leak)
▼ Yes
┌────────────────────────────────────────┐
│ reviewer_agent │
│ (Audits DDD layer purity & security) │
└───────────────────┬────────────────────┘
│
[before_commit Gate]
│
▼
┌────────────────────────────────────────┐
│ Milestone Commit & Memory Store │
└────────────────────────────────────────┘1. business_analyst (Requirements & Invariants)
- Identifies three Bounded Contexts:
Tenancy,Catalog, andOrders. - Formulates hard domain invariants:
- Invariant 1 (Mandatory Tenant Scoping): Every table in Catalog and Orders must have an indexed
tenant_idforeign key. - Invariant 2 (Context Resolution): Inbound HTTP requests must resolve tenant identity via
X-Tenant-IDheader or authenticated vendor credentials; missing or invalid tenants abort with401 Unauthorizedor400 Bad Request. - Invariant 3 (Order Splitting): Single customer checkouts with items from multiple vendors must execute an atomic split into vendor-specific sub-orders.
- Invariant 4 (Zero Cross-Tenant Leakage): Queries filtered by tenant must return
404 Not Foundif a vendor attempts to access another vendor's resource.
- Invariant 1 (Mandatory Tenant Scoping): Every table in Catalog and Orders must have an indexed
2. product_manager (Task Decomposition & Scope Metadata)
Breaks down the feature into prioritized tasks annotated with dependencies (depends_on) and filesystem boundaries (scope_paths):
task_1: Tenancy Context Core- Scope:
app/Domains/Tenancy/*,database/migrations/*_create_tenants_table.php.
- Scope:
task_2: Catalog Context & Tenant Scoping- Depends On:
task_1. - Scope:
app/Domains/Catalog/*,database/migrations/*_create_products_table.php.
- Depends On:
task_3: Orders Context & Order Splitting Service- Depends On:
task_1,task_2. - Scope:
app/Domains/Orders/*,database/migrations/*_create_orders_table.php.
- Depends On:
task_4: Cross-Tenant Feature Test Suite & OpenAPI Docs- Depends On:
task_1,task_2,task_3. - Scope:
tests/Feature/*,docs/swagger.json.
- Depends On:
3. architect (DDD System Design & Layering)
Designs the domain architecture conforming to clean architecture and DDD standards:
- Value Objects:
TenantId,ProductId,OrderId,Money(immutable currency and amount). - Domain Services:
OrderSplitterresponsible for partitioning line items into vendor sub-orders. - Global Scope:
TenantScopeapplyingwhere('tenant_id', '=', TenantContext::id()). - Directory Layout:text
app/Domains/ ├── Tenancy/ │ ├── Domain/ │ │ ├── Model/Tenant.php │ │ ├── ValueObject/TenantId.php │ │ ├── Enum/TenantStatus.php │ │ └── Repository/TenantRepositoryInterface.php │ ├── Application/ │ │ ├── Actions/RegisterVendorAction.php │ │ └── DTO/VendorRegistrationData.php │ ├── Infrastructure/ │ │ ├── Persistence/EloquentTenantRepository.php │ │ └── Scopes/TenantScope.php │ └── Interfaces/Http/ │ ├── Controllers/VendorRegistrationController.php │ └── Middleware/TenantResolverMiddleware.php ├── Catalog/ │ ├── Domain/ │ │ ├── Model/Product.php │ │ ├── ValueObject/ProductId.php │ │ ├── ValueObject/Money.php │ │ └── ValueObject/SKU.php │ ├── Application/ │ │ ├── Actions/CreateProductAction.php │ │ └── Actions/UpdateInventoryAction.php │ ├── Infrastructure/ │ │ └── Persistence/EloquentProductRepository.php │ └── Interfaces/Http/ │ ├── Controllers/ProductCatalogController.php │ └── Requests/StoreProductRequest.php └── Orders/ ├── Domain/ │ ├── Model/Order.php │ ├── Model/OrderLineItem.php │ └── Services/OrderSplitter.php ├── Application/ │ └── Actions/PlaceCustomerOrderAction.php ├── Infrastructure/ │ └── Persistence/EloquentOrderRepository.php └── Interfaces/Http/ ├── Controllers/CheckoutController.php └── Resources/OrderResource.php
4. database_agent & backend_agent (Parallel Wave Implementation)
- Tenancy Implementation: Authors migrations for
tenantsanduserstables,Tenantmodel, andTenantResolverMiddleware. - Parallel Scheduling: Because
CatalogandOrdershave non-overlappingscope_paths,ParallelSchedulerexecutes their boilerplate generations across concurrent branches:database_agentcreatesproductstable with compound unique index['tenant_id', 'sku']andorderstable with foreign keys.backend_agentimplementsStoreProductRequestenforcing per-tenant SKU validation:phpRule::unique('products')->where(fn ($query) => $query->where('tenant_id', $tenantId))backend_agentimplementsOrderSplitterdomain service:phppublic function split(CustomerCart $cart): Collection { return $cart->items->groupBy('product.tenant_id')->map(function ($items, $tenantId) { return new VendorSubOrder($tenantId, $items); }); }
5. swagger_agent (OpenAPI Spec with Tenant Headers)
- Inspects
TenantResolverMiddlewareand generates OpenAPI 3.0+ specifications indocs/swagger.json. - Automatically injects the required tenant header parameter:json
"parameters": [ { "name": "X-Tenant-ID", "in": "header", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Unique identifier of the tenant context" } ]
6. qa_agent & fixer_agent (Cross-Tenant Security Verification)
qa_agent writes focused feature tests asserting tenant isolation:
test_vendor_can_only_view_own_catalog_products()test_vendor_cannot_mutate_another_vendors_product(): Asserts that querying product of Vendor A with Vendor B's tenant context yields404 Not Found.test_request_without_tenant_header_is_rejected_by_middleware()test_multi_vendor_checkout_splits_orders_correctly()- Invokes
TestRunnerTool(php artisan test --without-tty). If any query leaks cross-tenant records,fixer_agentintercepts the failure, patches the repository to includeTenantScope, and re-runs tests until all pass.
7. reviewer_agent & git_agent
reviewer_agentaudits the codebase:- Verifies that Domain models contain no Eloquent or database coupling.
- Confirms all database queries are scoped by
tenant_id. - Approves the implementation.
git_agentstages all artifacts and commits to feature branchorcest/multi-vendor-ddd-core.
Example CLI Commands
1. Dry-Run Architectural Preview
Inspect the proposed DDD structure and tasks before writing any code:
php artisan orcest:build \
"Build a Multi-Vendor Marketplace Core with Tenancy, Catalog, and Orders Bounded Contexts using Domain-Driven Design" \
--dry-run2. Interactive Run with Human Review Gates
Run with interactive review gates (after_plan and before_commit) enabled:
php artisan orcest:build \
"Build a Multi-Vendor Marketplace Core with Tenancy, Catalog, and Orders Bounded Contexts using Domain-Driven Design" \
--interactive \
--swagger \
--swagger-format=both3. Inspecting Paused State
When execution pauses at after_plan, inspect the proposed DDD architecture:
php artisan orcest:status
php artisan orcest:status run_67e2a9b401f894. Approving the Architectural Plan
Approve the proposed Bounded Contexts, Value Objects, and TenantScope:
php artisan orcest:approve run_67e2a9b401f89 --note="Approved DDD layout, Bounded Context boundaries, and TenantScope strategy"5. Unattended CI/CD Execution
For automated testing in continuous delivery pipelines:
php artisan orcest:build \
"Build a Multi-Vendor Marketplace Core with Tenancy, Catalog, and Orders Bounded Contexts using Domain-Driven Design" \
--no-human-review \
--swaggerNext Steps
- Review reference configuration files: Examples Directory
- Check tool sandboxing details: Safety & HITL Guide
