PHPackages                             laraigent/larai-kit - 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. [API Development](/categories/api)
4. /
5. laraigent/larai-kit

ActiveLibrary[API Development](/categories/api)

laraigent/larai-kit
===================

Laravel RAG and AI agent toolkit — drop-in document ingestion, vector search, streaming chat, and multi-tenant scoping for Laravel 12/13. Works with OpenAI, Anthropic, Gemini, Pinecone, and pgvector.

0.2.4(1mo ago)14103MITPHPPHP ^8.3

Since Apr 12Pushed 2w agoCompare

[ Source](https://github.com/LarAIgent/larai-kit)[ Packagist](https://packagist.org/packages/laraigent/larai-kit)[ Docs](https://github.com/LarAIgent/larai-kit)[ RSS](/packages/laraigent-larai-kit/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (7)Dependencies (4)Versions (10)Used By (0)

[![readme-banner-slim](https://private-user-images.githubusercontent.com/88287021/589097179-74fe8672-0524-446e-acc7-ef9e7a72c347.jpg?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODA5NzQ5NDAsIm5iZiI6MTc4MDk3NDY0MCwicGF0aCI6Ii84ODI4NzAyMS81ODkwOTcxNzktNzRmZTg2NzItMDUyNC00NDZlLWFjYzctZWY5ZTdhNzJjMzQ3LmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA2MDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNjA5VDAzMTA0MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTAwNmYyODAzMTRlYzJjYTk4YThlNWNmMjJkZjk3M2NlZTU0Zjg0NTBmNWY3NGIyMGVkZDMzODllMjIyY2RjZTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRmpwZWcifQ.4Bvp76ulFKUdcyPH6MqFz2fHn6YdbqXZ0J8dciOMOCM)](https://private-user-images.githubusercontent.com/88287021/589097179-74fe8672-0524-446e-acc7-ef9e7a72c347.jpg?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODA5NzQ5NDAsIm5iZiI6MTc4MDk3NDY0MCwicGF0aCI6Ii84ODI4NzAyMS81ODkwOTcxNzktNzRmZTg2NzItMDUyNC00NDZlLWFjYzctZWY5ZTdhNzJjMzQ3LmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA2MDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNjA5VDAzMTA0MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTAwNmYyODAzMTRlYzJjYTk4YThlNWNmMjJkZjk3M2NlZTU0Zjg0NTBmNWY3NGIyMGVkZDMzODllMjIyY2RjZTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRmpwZWcifQ.4Bvp76ulFKUdcyPH6MqFz2fHn6YdbqXZ0J8dciOMOCM)
[![Latest Version on Packagist](https://camo.githubusercontent.com/ad32c3ce9d29ecbfbf551806e656996c8a224182e633b2069fcaf566e5ee3a80/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6172616967656e742f6c617261692d6b69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laraigent/larai-kit)[![Total Downloads](https://camo.githubusercontent.com/e7885ee8017d5a32e068b7e151594acb5d52be69ae4247336facd2664cc19038/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6172616967656e742f6c617261692d6b69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laraigent/larai-kit)[![PHP Version](https://camo.githubusercontent.com/5202e4cc218839c03977f279bc1b6bdabdcb1101094c0f5523799edcfbe7fc79/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c6172616967656e742f6c617261692d6b69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laraigent/larai-kit)[![Laravel 12 / 13](https://camo.githubusercontent.com/ecbc9fec9cd77a69062ec232050c6a4bead17d8d9df0a013cbf0d2ec76a534d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d313225323025374325323031332d6666326432303f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c)](https://laravel.com)[![License](https://camo.githubusercontent.com/cf0de38620ee70f842beaa46a6b7df5bc5061acfd4acbdbc85380e71688b7902/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c6172616967656e742f6c617261692d6b69742e7376673f7374796c653d666c61742d737175617265)](LICENSE)

LarAI Kit — Laravel RAG &amp; AI Agent Toolkit
==============================================

[](#larai-kit--laravel-rag--ai-agent-toolkit)

**Production-ready RAG, AI agents, document ingestion, vector search, and streaming chat for Laravel 12 and 13.** Drop-in package built on top of [Laravel's first-party AI SDK](https://laravel.com/blog/introducing-the-laravel-ai-sdk) — works with **OpenAI**, **Anthropic**, and **Gemini**; supports **Pinecone** and **pgvector** for vector search; parses **PDF**, **DOCX**, plain text, and URLs out of the box.

> Install in 30 seconds. No lock-in. Fully backward compatible. Multi-tenant ready.

```
composer require laraigent/larai-kit
```

---

Table of Contents
-----------------

[](#table-of-contents)

- [Why LarAI Kit?](#why-larai-kit)
- [Use Cases](#use-cases)
- [Features](#features)
- [Quickstart](#quickstart)
- [Feature Tiers](#feature-tiers)
- [Configuration](#configuration)
- [Usage](#usage)
    - [Chat with RAG context](#chat-with-rag-context)
    - [Conversations (persistent chat threads)](#conversations-persistent-chat-threads)
    - [Streaming chat (SSE)](#streaming-chat-sse)
    - [Ingest documents](#ingest-documents)
    - [Create a custom agent](#create-a-custom-agent)
    - [Web health endpoint (JSON)](#web-health-endpoint-json)
- [Artisan Commands](#artisan-commands)
- [Architecture](#architecture)
- [Ingestion Pipeline](#ingestion-pipeline)
- [Supported File Types](#supported-file-types)
- [Requirements](#requirements)
- [Documentation](#documentation)
- [FAQ](#faq)
- [Contributing](#contributing)
- [License](#license)

---

Why LarAI Kit?
--------------

[](#why-larai-kit)

Laravel's AI SDK gives you the low-level building blocks (`Agent`, `Tool`, `prompt()`). But building a production **RAG (Retrieval-Augmented Generation) pipeline** for a Laravel app still requires a lot of plumbing:

- How do I parse PDFs and DOCX files into clean text?
- How do I chunk documents and generate OpenAI / Anthropic / Gemini embeddings?
- How do I store and search vectors in **Pinecone** or **pgvector**?
- How do I inject relevant context into my agent's prompt without hand-crafting it?
- How do I scope retrieval per tenant so customers never see each other's data?
- How do I make all this **not break** when one service is unavailable?

**LarAI Kit solves all of this.** One `composer require`, a few `.env` keys, and you have a working Laravel RAG pipeline with source-cited answers and streaming SSE chat.

---

Use Cases
---------

[](#use-cases)

LarAI Kit is the fastest path to building:

- **Customer support chatbots** — RAG over your FAQ, help-center docs, product manuals, and policies with automatic source citations
- **Internal knowledge search** — semantic search over Confluence exports, Notion dumps, wikis, and internal PDFs for your team
- **Multi-tenant SaaS chatbots** — scope every ingest, retrieval, and conversation per customer (Chatbase-style platforms, but self-hosted)
- **Document Q&amp;A** — upload PDFs, Word docs, or URLs; ask natural-language questions over them
- **AI agents with tools** — booking agents, product-lookup agents, order-status bots with custom tool calling
- **Streaming AI responses** — Server-Sent Events (SSE) streaming with token-by-token deltas and final source attribution
- **Compliance-aware AI features** — Laravel-native scoping and per-tenant isolation that plays nicely with your existing auth/authorization

---

Features
--------

[](#features)

FeatureDescription**AI Agents + Tools**Pre-built `SupportAgent` (RAG) and `BookingAgent` (tools) + `make:larai-agent` and `make:larai-tool` scaffolding**Document Ingestion**Upload text, PDF, DOCX, or URL → auto parse → chunk with overlap → batch embed → batch upsert**URL Ingestion**`ingestUrl()` with SSRF protection, HTML/text parsing, chunking, and embedding**Vector Search**Pinecone (default) or pgvector — swappable via `.env`, with retry/backoff and scoped search**RAG Chat**Retrieves top-k relevant context, injects into prompt, returns reply + source citations**Streaming Chat (SSE)**`streamMessage()` returns an SSE-ready response — token-by-token deltas with sources at the end**Persistent Conversations**Chat threads via `Conversation` + `Message` models (UUID PKs, scope-aware, history-limited)**Multi-Tenant Scoping**Scope ingestion, retrieval, and conversations per tenant — prevents data leaks between customers**Usage &amp; Cost Tracking**`ChatCompleted` + `EmbeddingsCompleted` events with real token counts; opt-in DB persistence via `ai_usage`**Graceful Degradation**App works at every tier — missing services disable features, never crash your app**Multi-Provider LLMs**OpenAI, Anthropic (Claude), Gemini — switch via `LARAI_AI_PROVIDER`**Multi-Database**MySQL 8+ (default) or PostgreSQL 14+ — migrations adapt automatically**Batch Operations**`embedMany()` and `upsertMany()` — ~100x fewer API calls on large documents**Health Endpoint**JSON health check at `/_larai/health` (env-configurable middleware) + `larai:doctor --deep` CLI**Artisan Commands**`larai:install`, `larai:doctor`, `larai:chat`, `make:larai-agent`, `make:larai-tool`---

Quickstart
----------

[](#quickstart)

```
# 1. Install
composer require laraigent/larai-kit

# 2. Publish config + run migrations
php artisan larai:install

# 3. Add your keys to .env
OPENAI_API_KEY=sk-your-key
PINECONE_API_KEY=pcsk_your-key
PINECONE_INDEX_HOST=https://your-index.svc.pinecone.io

# 4. Verify
php artisan larai:doctor
```

You now have a RAG-enabled AI agent wired into your Laravel app — ingest your first document and chat with it:

```
use LarAIgent\AiKit\Services\Ingestion\IngestionService;
use LarAIgent\AiKit\Services\Chat\ChatService;

app(IngestionService::class)->ingestText('Our return policy allows returns within 30 days of purchase.');

$reply = app(ChatService::class)->sendMessage('How long do I have to return a product?');
// $reply['reply']   => "You have 30 days from the date of purchase..."
// $reply['sources'] => [{ name, url, type }, ...]
```

### Before you go to production — three things to know

[](#before-you-go-to-production--three-things-to-know)

1. The namespace is `LarAIgent\AiKit\...` (case-sensitive — matters on Linux deployments)
2. Run `php artisan queue:work` in a separate process, or set `QUEUE_CONNECTION=sync` in `.env` — otherwise ingestion jobs queue silently
3. OpenAI tier-1 keys allow ~3 RPM for embeddings — a 50KB document may rate-limit you. Set `LARAI_RETRY_MAX=5` or upgrade your OpenAI tier.

---

Feature Tiers
-------------

[](#feature-tiers)

LarAI Kit detects which services are available and enables features accordingly — never crashes on missing config:

TierWhat you configureWhat works0NothingApp boots; AI features disabled gracefully**1**`OPENAI_API_KEY` (or Anthropic / Gemini)Chat works (no RAG)**2**+ `PINECONE_API_KEY` (or pgvector)Chat + RAG (semantic search over your documents)**3**+ AWS S3 credentialsChat + RAG + cloud file storage---

Configuration
-------------

[](#configuration)

All settings are managed via `.env`. No code changes to switch providers.

### AI Provider

[](#ai-provider)

```
LARAI_AI_PROVIDER=openai     # openai, anthropic, gemini
OPENAI_API_KEY=sk-...
# or
ANTHROPIC_API_KEY=sk-ant-...
# or
GEMINI_API_KEY=...
```

### Vector Store

[](#vector-store)

```
LARAI_VECTOR_STORE=pinecone  # pinecone, pgvector, none

# Pinecone (works with MySQL or PostgreSQL)
PINECONE_API_KEY=pcsk_...
PINECONE_INDEX_HOST=https://your-index.svc.pinecone.io

# pgvector (requires PostgreSQL + pgvector extension)
# Just set LARAI_VECTOR_STORE=pgvector — no extra keys needed
```

### Database

[](#database)

```
DB_CONNECTION=mysql          # mysql or pgsql — both fully supported
```

### Full Config Reference

[](#full-config-reference)

Run `php artisan vendor:publish --tag=larai-kit-config` to publish `config/larai-kit.php`, then see [Configuration Docs](docs/configuration.md) for all tunables.

---

Usage
-----

[](#usage)

### Chat with RAG context

[](#chat-with-rag-context)

```
use LarAIgent\AiKit\Services\Chat\ChatService;

$chat = app(ChatService::class);
$result = $chat->sendMessage('What is your return policy?');

$result['reply'];   // AI response grounded in your ingested documents
$result['sources']; // [{ name, url, type }, ...] for citation UI
```

### Conversations (persistent chat threads)

[](#conversations-persistent-chat-threads)

```
use LarAIgent\AiKit\Services\Chat\ConversationManager;

$conversations = app(ConversationManager::class);
$chat = app(ChatService::class);

// Create a scoped conversation
$convo = $conversations->create(scope: ['chatbot_id' => 42], title: 'Support thread');

// Send messages — history auto-loaded and persisted
$result = $chat->sendMessage('What is the return policy?', conversationId: $convo->id);
$result = $chat->sendMessage('How long do I have?', conversationId: $convo->id);
// Both messages + replies are stored in ai_messages
```

### Streaming chat (SSE)

[](#streaming-chat-sse)

```
// In a controller — return directly for automatic SSE response
public function stream(Request $request)
{
    $chat = app(ChatService::class);
    return $chat->streamMessage($request->input('message'))
        ->withOnComplete(function (string $fullText, mixed $usage, array $sources) {
            // Optional: persist assistant output, counters, timestamps, etc.
        });
    // Emits:  data: {"type":"text_delta","delta":"..."}  (per chunk)
    //         data: {"type":"sources","sources":[...]}    (at the end)
    //         data: {"type":"done"}
}
```

### Ingest documents

[](#ingest-documents)

```
use LarAIgent\AiKit\Services\Ingestion\IngestionService;

$ingestion = app(IngestionService::class);

// Ingest plain text
$asset = $ingestion->ingestText('Our return policy allows returns within 30 days...');

// Ingest a file (PDF, DOCX, TXT)
$asset = $ingestion->ingestFile($request->file('document'));

// Ingest from an existing disk path (no UploadedFile required)
$asset = $ingestion->ingestFromDisk('public', 'knowledge-bases/policy.pdf');

// Ingest a URL (with SSRF protection for private networks)
$asset = $ingestion->ingestUrl('https://example.com/docs/faq');

// With multi-tenant scope — retrieval will only see this tenant's data
$asset = $ingestion->ingestUrl('https://example.com/docs', scope: ['chatbot_id' => 42]);
```

### Create a custom agent

[](#create-a-custom-agent)

```
php artisan make:larai-agent ProductAgent
```

```
// app/Ai/Agents/ProductAgent.php
class ProductAgent implements Agent, HasTools
{
    use Promptable;

    public function instructions(): string
    {
        return 'You are a product expert. Use the knowledge base to answer questions.';
    }

    public function tools(): iterable
    {
        return [
            SimilaritySearch::usingModel(Document::class, 'embedding'),
        ];
    }
}
```

### Create a custom tool

[](#create-a-custom-tool)

```
php artisan make:larai-tool CheckOrderTool
```

### Check system health

[](#check-system-health)

```
php artisan larai:doctor        # config checks
php artisan larai:doctor --deep  # + live API probe (embedding test)
```

```
LarAI Kit Health Check

  [OK]      Database (mysql, 3.2ms)
  [OK]      AI Provider (openai)
  [OK]      Embedding probe (1536 dims, 2841ms)     chunk -> embed)
          +-- RetrievalService   (semantic search)
          +-- ChatService        (RAG chat, streaming, conversations)
          +-- ConversationManager (persistent threads)
          +-- HealthCheck        (system diagnostics)
          +-- UrlFetcher         (SSRF-protected HTTP fetch)

```

---

Ingestion Pipeline
------------------

[](#ingestion-pipeline)

When you ingest a document (file, text, or URL), this happens automatically:

```
File/Text/URL --> Validate --> Store/Fetch --> Parse to text --> Chunk (with overlap)
    --> Batch embed --> Batch upsert to vector store --> Done

```

Each step is a queued job (or runs synchronously when `QUEUE_CONNECTION=sync`):

- `ParseAssetJob` — extracts text from PDF, DOCX, HTML, or plain text
- `ChunkAssetJob` — splits into overlapping chunks (configurable size)
- `EmbedChunksJob` — generates embeddings and upserts to Pinecone / pgvector

State is tracked in the `ai_ingestions` table: `queued → parsing → chunking → embedding → indexed`. Subscribe to `AssetIndexed` / `AssetFailed` events for post-ingest workflows (see [Ingestion Pipeline Docs](docs/ingestion-pipeline.md)).

---

Supported File Types
--------------------

[](#supported-file-types)

TypeExtensionParserPlain text`.txt`, `.md`, `.csv`Built-inHTML`.html` (or via URL)Built-in (`DOMDocument`)PDF`.pdf`Requires `smalot/pdfparser`Word`.docx`Requires `phpoffice/phpword`Install optional parsers:

```
composer require smalot/pdfparser phpoffice/phpword
```

---

Requirements
------------

[](#requirements)

- **PHP** 8.3+
- **Laravel** 12 or 13
- **`laravel/ai`** ^0.4
- **Database**: MySQL 8+ or PostgreSQL 14+
- **AI provider API key**: OpenAI, Anthropic, or Gemini
- **Vector store (optional)**: Pinecone account or PostgreSQL with pgvector extension

---

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

[](#documentation)

PageDescription[Installation](docs/installation.md)Step-by-step setup guide[Configuration](docs/configuration.md)All `.env` options and config reference[Agents &amp; Tools](docs/agents-and-tools.md)Creating custom agents and tools, ChatService parameters[Ingestion Pipeline](docs/ingestion-pipeline.md)File, text, and URL ingestion with pipeline events[Vector Stores](docs/vector-stores.md)Pinecone vs pgvector, multi-tenant scoping, batch ops[Artisan Commands](docs/artisan-commands.md)All CLI commands including `--deep` mode[Testing](docs/testing.md)How to test with fakes---

Community Examples
------------------

[](#community-examples)

Real-world starter prompts built and tested by the community. Browse [`examples/`](examples/) or jump straight to:

- [SaaS Chatbot Platform](examples/prompts/01-saas-chatbot-platform/) — Build a full multi-tenant chatbot SaaS (like Chatbase) with Laravel 13

---

FAQ
---

[](#faq)

### How is LarAI Kit different from the Laravel AI SDK?

[](#how-is-larai-kit-different-from-the-laravel-ai-sdk)

The [Laravel AI SDK](https://laravel.com/blog/introducing-the-laravel-ai-sdk) provides low-level primitives: `Agent`, `Tool`, `prompt()`, embeddings, streaming. **LarAI Kit is additive** — it sits on top and provides the RAG pipeline (document parsing, chunking, embedding, vector storage, retrieval, prompt injection, source citations) that the SDK intentionally leaves out. You still use the SDK directly for anything custom; LarAI Kit just saves you from rebuilding the common pieces.

### Can I use LarAI Kit without Pinecone?

[](#can-i-use-larai-kit-without-pinecone)

Yes. Set `LARAI_VECTOR_STORE=pgvector` to use PostgreSQL's pgvector extension, or `LARAI_VECTOR_STORE=none` to disable RAG entirely (chat still works). No code changes.

### Does it work with Laravel 11?

[](#does-it-work-with-laravel-11)

No — LarAI Kit requires Laravel 12 or 13 because it depends on `laravel/ai ^0.4`, which itself requires the Laravel 12+ container. If you're on Laravel 11, upgrade first (the upgrade from 11 → 12 is typically small).

### Which LLM providers are supported?

[](#which-llm-providers-are-supported)

OpenAI (default), Anthropic (Claude 3.5 Sonnet / 4), and Google Gemini. Switch via `LARAI_AI_PROVIDER=openai|anthropic|gemini`. Chat, streaming, and tool calling all route through the same `Agent` contract — your code doesn't change when you switch providers.

### How do I ingest a PDF?

[](#how-do-i-ingest-a-pdf)

```
composer require smalot/pdfparser
```

```
app(IngestionService::class)->ingestFile($request->file('document'));
```

The pipeline detects the MIME type, routes through `PdfParser`, chunks with overlap, embeds in batches, and upserts to your vector store. Check `$asset->ingestion->state` for the final status.

### How does multi-tenant scoping work?

[](#how-does-multi-tenant-scoping-work)

Pass a `scope` array on every ingest / retrieve / conversation call:

```
$ingestion->ingestText($text, scope: ['chatbot_id' => 42]);
$chat->sendMessage($message, scope: ['chatbot_id' => 42]);
```

Pinecone uses metadata `$eq` filters under the hood; pgvector uses JSON `WHERE` clauses. Tenants never see each other's vectors — crucial for SaaS chatbot platforms where each customer uploads their own knowledge base.

### Is streaming SSE supported out of the box?

[](#is-streaming-sse-supported-out-of-the-box)

Yes. `ChatService::streamMessage()` returns a `ChatStreamResponse` that implements Laravel's `Responsable` interface — return it directly from a controller and you get a fully-formed SSE response (token-by-token deltas, sources at the end, `[done]` event). No manual `StreamedResponse` wiring needed.

### How do I track AI usage and costs?

[](#how-do-i-track-ai-usage-and-costs)

Listen for the `ChatCompleted` and `EmbeddingsCompleted` events — they carry real provider-reported token counts:

```
Event::listen(ChatCompleted::class, function ($event) {
    Log::info('AI usage', [
        'provider' => $event->provider,
        'model' => $event->model,
        'input' => $event->inputTokens,
        'output' => $event->outputTokens,
        'scope' => $event->scope,
    ]);
});
```

Or set `LARAI_TRACK_USAGE=true` to persist automatically to the `ai_usage` table.

### Can I use LarAI Kit with an existing Laravel AI SDK app?

[](#can-i-use-larai-kit-with-an-existing-laravel-ai-sdk-app)

Yes — LarAI Kit adds services without touching anything the SDK provides. Your existing `Agent` classes, tools, and `prompt()` calls keep working unchanged. LarAI Kit just gives you the RAG layer on top.

---

v0.2.4 Notes
------------

[](#v024-notes)

- `IngestionService::ingestFromDisk($disk, $path, $scope)` is now available for re-index and recovery workflows.
- `ChatStreamResponse::withOnComplete()` lets you chain post-stream persistence without rebuilding the SSE loop.
- `ingestText()` and `ingestUrl()` now run through queued entry jobs for consistency with `ingestFile()`.
- Terminal ingestion events (`AssetIndexed`, `AssetFailed`) are now aligned with transaction commit boundaries.

---

Contributing
------------

[](#contributing)

Contributions are welcome! Please:

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

---

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

---

Credits
-------

[](#credits)

- Built on [Laravel AI SDK](https://laravel.com/blog/introducing-the-laravel-ai-sdk)
- Inspired by the gap between Python RAG frameworks (LangChain, LlamaIndex) and the Laravel ecosystem — Laravel developers deserve first-class RAG tooling too

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance95

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 89.5% 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 ~3 days

Total

7

Last Release

38d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f53231332ec899f1959bab1c932ad95640f0b2581428aed4d2cfe12d7a6a1e64?d=identicon)[Awais-Asad](/maintainers/Awais-Asad)

---

Top Contributors

[![Awais-Asad](https://avatars.githubusercontent.com/u/88287021?v=4)](https://github.com/Awais-Asad "Awais-Asad (17 commits)")[![guru-ai-expert](https://avatars.githubusercontent.com/u/277421508?v=4)](https://github.com/guru-ai-expert "guru-ai-expert (1 commits)")[![imranhussainlaravel](https://avatars.githubusercontent.com/u/180255343?v=4)](https://github.com/imranhussainlaravel "imranhussainlaravel (1 commits)")

---

Tags

agentaiai-agentanthropicchatbotclaudedocument-ingestionembeddingsgeminilaravellaravel-ailaravel-packagellmopenaipgvectorpineconeragsemantic-searchvector-searchlaravelaistreaminglaravel-packageopenaiAgentssemulti-tenantGeminiclaudechatbotllmanthropicai-agentembeddingspineconeraglaravel-aipgvectorlaravel-ragvector-searchsemantic-searchdocument-ingestionpdf-parsing

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/laraigent-larai-kit/health.svg)

```
[![Health](https://phpackages.com/badges/laraigent-larai-kit/health.svg)](https://phpackages.com/packages/laraigent-larai-kit)
```

###  Alternatives

[vizra/vizra-adk

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

29431.7k](/packages/vizra-vizra-adk)[mozex/anthropic-laravel

Laravel integration for the Anthropic API: facade, config publishing, install command, testing fakes, messages, streaming, tool use, thinking, and batches.

74287.1k1](/packages/mozex-anthropic-laravel)[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).

6342.4k](/packages/sbsaga-toon)[vectorifyai/vectorify-laravel

Vectorify package for Laravel. The fastest way to ask AI about your data.

196.1k](/packages/vectorifyai-vectorify-laravel)[mohamed-ashraf-elsaed/claude-agent-sdk-laravel

Anthropic Claude Agent SDK for PHP &amp; Laravel — build AI agents with tool use, sandboxing, MCP servers, subagents, hooks, and structured output via the Claude Code CLI

151.1k](/packages/mohamed-ashraf-elsaed-claude-agent-sdk-laravel)

PHPackages © 2026

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