PHPackages                             m-tech-stack/laravel-ai-engine - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. m-tech-stack/laravel-ai-engine

ActiveLibrary[HTTP &amp; Networking](/categories/http)

m-tech-stack/laravel-ai-engine
==============================

Laravel AI agent engine for orchestration, structured tools, RAG, and deterministic node federation across Laravel apps.

2.2.23(2mo ago)11.1k[1 PRs](https://github.com/mabou7agar/laravel-ai-support/pulls)MITPHPPHP ^8.1

Since Nov 28Pushed 2mo agoCompare

[ Source](https://github.com/mabou7agar/laravel-ai-support)[ Packagist](https://packagist.org/packages/m-tech-stack/laravel-ai-engine)[ RSS](/packages/m-tech-stack-laravel-ai-engine/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (20)Versions (31)Used By (0)

Laravel AI Engine
=================

[](#laravel-ai-engine)

Laravel AI Engine is a Laravel package for AI chat orchestration, deterministic tool execution, RAG, and node federation across multiple Laravel apps.

Status (March 2026)
-------------------

[](#status-march-2026)

Current codebase includes:

- modular orchestrator (`IntentRouter`, `AgentPlanner`, action execution, response finalizer)
- autonomous RAG split into focused services (decision, execution, context/state, policy, feedback, structured data)
- deterministic node routing via ownership and manifest metadata (no AI-only node guessing)
- standardized response envelope (`success`, `message`, `data`, `error`, `meta`)
- localization stack (locale middleware, lexicons, prompt templates)
- prompt policy learning with DB-backed feedback events and policy versions
- infrastructure hardening (remote migration guard, Qdrant self-check, startup health gate)
- admin UI with user/email/IP access controls

Compatibility
-------------

[](#compatibility)

- package: `m-tech-stack/laravel-ai-engine`
- PHP: `^8.1`
- Laravel: `8.x | 9.x | 10.x | 11.x | 12.x`
- Guzzle: `^7.0`
- OpenAI PHP client: `^0.8 | ^0.9 | ^0.10`
- Symfony HTTP client: `^5.4 | ^6.0 | ^7.0`

Source of truth: `composer.json`.

Install
-------

[](#install)

```
composer require m-tech-stack/laravel-ai-engine
php artisan vendor:publish --tag=ai-engine-config
php artisan vendor:publish --tag=ai-engine-migrations
php artisan migrate
```

Minimal Production Baseline
---------------------------

[](#minimal-production-baseline)

```
AI_ENGINE_DEFAULT=openai
AI_ENGINE_DEFAULT_MODEL=gpt-4o
AI_ORCHESTRATION_MODEL=gpt-4o-mini
OPENAI_API_KEY=your_key

AI_ENGINE_STANDARDIZE_API_RESPONSES=true
AI_ENGINE_API_RESPONSE_PRESERVE_LEGACY=true

AI_ENGINE_INJECT_USER_CONTEXT=true
AI_ENGINE_LOCALIZATION_ENABLED=true
AI_ENGINE_SUPPORTED_LOCALES=en,ar
AI_ENGINE_FALLBACK_LOCALE=en

AI_ENGINE_REMOTE_NODE_MIGRATION_GUARD=true
AI_ENGINE_QDRANT_SELF_CHECK_ENABLED=true
AI_ENGINE_STARTUP_HEALTH_GATE_ENABLED=true
```

For multi-app federation:

```
AI_ENGINE_NODES_ENABLED=true
AI_ENGINE_IS_MASTER=true
AI_ENGINE_NODE_JWT_SECRET=change_me
```

High-Value Commands
-------------------

[](#high-value-commands)

### Diagnostics

[](#diagnostics)

```
php artisan ai-engine:test-package
php artisan ai-engine:test-real-agent --script=followup --json
php artisan ai-engine:infra-health
```

### Federation (Safe Workflow)

[](#federation-safe-workflow)

```
php artisan ai-engine:node-list
php artisan ai-engine:node-ping --all
php artisan ai-engine:nodes-sync --file=config/ai-engine-nodes.json
php artisan ai-engine:nodes-sync --file=config/ai-engine-nodes.json --autofix
php artisan ai-engine:nodes-sync --file=config/ai-engine-nodes.json --apply --prune --ping --force
php artisan ai-engine:node-cleanup --status=error --days=0 --apply --force
```

### Prompt Policy Learning (Policy-Level)

[](#prompt-policy-learning-policy-level)

```
php artisan ai-engine:decision-feedback:report
php artisan ai-engine:decision-policy:evaluate --window-hours=48
php artisan ai-engine:decision-policy:create v2 --activate
php artisan ai-engine:decision-policy:activate 2
```

Entity List UX (Important)
--------------------------

[](#entity-list-ux-important)

List responses are model-driven:

- implement `toRAGListPreview(?string $locale = null)` for clean multi-line list cards
- implement `toAISummarySource()` for compact summary cache input

If `toRAGListPreview()` exists, it is preferred over fallback summary rendering in structured list responses.

Admin UI
--------

[](#admin-ui)

Enable:

```
AI_ENGINE_ENABLE_ADMIN_UI=true
AI_ENGINE_ADMIN_PREFIX=ai-engine/admin
AI_ENGINE_ADMIN_ALLOWED_USER_IDS=1
AI_ENGINE_ADMIN_ALLOWED_EMAILS=admin@example.com
AI_ENGINE_ADMIN_ALLOWED_IPS=127.0.0.1,::1
```

Open: `/ai-engine/admin` (or your configured prefix).

API Contract
------------

[](#api-contract)

```
{
  "success": true,
  "message": "Request completed.",
  "data": {},
  "error": null,
  "meta": {}
}
```

Built-in direct generation endpoints:

- `POST /api/v1/ai/generate/text`
- `POST /api/v1/ai/generate/image`
- `POST /api/v1/ai/generate/transcribe`
- `POST /api/v1/ai/generate/tts`

Authenticated calls are credit-enforced (same policy as chat/RAG), including image/audio endpoints.

Toggle/prefix with env:

```
AI_ENGINE_GENERATE_API_ENABLED=true
AI_ENGINE_GENERATE_API_PREFIX=api/v1/ai/generate
```

Inject your own middleware into package API routes:

```
AI_ENGINE_API_APPEND_MIDDLEWARE=auth:sanctum
AI_ENGINE_API_GENERATE_MIDDLEWARE=throttle:30,1
# For multiple middlewares, separate with semicolon:
# AI_ENGINE_API_GENERATE_MIDDLEWARE=auth:sanctum;throttle:30,1
# Or use JSON array for exact values:
# AI_ENGINE_API_GENERATE_MIDDLEWARE=["auth:sanctum","throttle:30,1"]
```

Documentation
-------------

[](#documentation)

Deep docs are in `docs-site` (Mintlify).

Run locally:

```
cd docs-site
npx mintlify dev
```

Recommended reading order:

1. `guides/quickstart`
2. `guides/concepts`
3. `guides/single-app-setup`
4. `guides/model-config-tools`
5. `guides/direct-generation-recipes`
6. `guides/entity-list-preview-ux`
7. `guides/data-collectors`
8. `guides/rag-indexing`
9. `guides/copy-paste-playbooks`
10. `guides/multi-app-federation`
11. `guides/policy-learning`
12. `guides/testing-playbook`

Upgrading Existing Installs
---------------------------

[](#upgrading-existing-installs)

If config was published before recent refactors, refresh it:

```
php artisan vendor:publish --tag=ai-engine-config --force
php artisan optimize:clear
```

See `docs-site/reference/upgrade.mdx` for the upgrade checklist.

License
-------

[](#license)

MIT

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance86

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 99.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Recently: every ~21 days

Total

25

Last Release

68d ago

PHP version history (2 changes)v2.1.0PHP ^8.0

v2.2.20PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/910aa2861357099f7cf10e3991b5108b93e4518cc34e2e8348d708578af1ccc0?d=identicon)[mabou7agar](/maintainers/mabou7agar)

---

Top Contributors

[![mabou7agar](https://avatars.githubusercontent.com/u/13303169?v=4)](https://github.com/mabou7agar "mabou7agar (460 commits)")[![AHishamCG](https://avatars.githubusercontent.com/u/127232185?v=4)](https://github.com/AHishamCG "AHishamCG (3 commits)")[![AhmedOsarh](https://avatars.githubusercontent.com/u/170966479?v=4)](https://github.com/AhmedOsarh "AhmedOsarh (1 commits)")

---

Tags

laravellaravel 8laravel 9laravel 10laravel 11laravel 12aiopenaiAgentchatGeminianthropicorchestrationragretrieval-augmented-generationvector-searchtool-executionnode-federation

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/m-tech-stack-laravel-ai-engine/health.svg)

```
[![Health](https://phpackages.com/badges/m-tech-stack-laravel-ai-engine/health.svg)](https://phpackages.com/packages/m-tech-stack-laravel-ai-engine)
```

###  Alternatives

[aws/aws-sdk-php-laravel

A simple Laravel 9/10/11/12/13 service provider for including the AWS SDK for PHP.

1.7k35.6M75](/packages/aws-aws-sdk-php-laravel)[vizra/vizra-adk

Vizra Agent Development Kit - A comprehensive Laravel package for building intelligent AI agents.

29026.1k](/packages/vizra-vizra-adk)[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

6115.6k](/packages/sbsaga-toon)[itsmurumba/laravel-mpesa

Laravel Package for Mpesa Daraja API

191.6k](/packages/itsmurumba-laravel-mpesa)[ip2location/ip2proxy-laravel

Allows user to query an IP address if it was being used as open proxy, web proxy, VPN anonymizer and TOR exits.

1063.2k](/packages/ip2location-ip2proxy-laravel)[goodway/laravel-nats

Nats jetstream queue driver with client for Laravel

304.8k](/packages/goodway-laravel-nats)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
