PHPackages                             laragent-dev/laragent-dev - 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. laragent-dev/laragent-dev

ActiveLibrary

laragent-dev/laragent-dev
=========================

Autonomous AI Agents for Laravel — local LLMs or cloud, your choice

v0.1.0(2mo ago)04MITPHPPHP ^8.2CI failing

Since Mar 9Pushed 1mo agoCompare

[ Source](https://github.com/laragent-dev/laragent-dev)[ Packagist](https://packagist.org/packages/laragent-dev/laragent-dev)[ Docs](https://laragent.dev)[ GitHub Sponsors](https://github.com/laragent-dev)[ RSS](/packages/laragent-dev-laragent-dev/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (14)Versions (2)Used By (0)

 [![Laragent](art/logo-wordmark.svg)](art/logo-wordmark.svg)

 [![Packagist Version](https://camo.githubusercontent.com/68721bc2d69f8231b1266305563d06d248d87227ab6b58ce21926ec0a302d3fd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c61726167656e742d6465762f6c61726167656e742d646576)](https://packagist.org/packages/laragent-dev/laragent-dev) [![Total Downloads](https://camo.githubusercontent.com/342d515a31ea4ee8bb85b613312f1cda7fbf2c2a650493ca051f80486a26d8b6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c61726167656e742d6465762f6c61726167656e742d646576)](https://packagist.org/packages/laragent-dev/laragent-dev) [![PHP](https://camo.githubusercontent.com/2795c86d2dea6aba6285347c2adef64310db832ec1d2d634a32e3b51115a5c95/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d373737424234)](https://php.net) [![Laravel](https://camo.githubusercontent.com/77092f3a4eb32d7a0c1409bbdc6607746f9c1515390aa5e15d98e5602d85d779/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31312532422d464632443230)](https://laravel.com) [![Tests](https://github.com/laragent-dev/laragent-dev/actions/workflows/tests.yml/badge.svg)](https://github.com/laragent-dev/laragent-dev/actions/workflows/tests.yml) [![License](https://camo.githubusercontent.com/e5d73a1a9acec5f5ed6b4e5b45e6d3e4a4ffeeef836400a87122db6e8d34a686/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d333842444638)](LICENSE)

**Autonomous AI Agents for Laravel. Runs locally for free. No API keys required.**

---

Why Laragent?
-------------

[](#why-laragent)

- **Free by default** — runs on [Ollama](https://ollama.ai) locally, no API key needed
- **Laravel-native** — uses facades, events, queues, and Eloquent you already know
- **Ships fast** — `composer require` + `php artisan laragent:install` and you're running

---

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

[](#requirements)

### For local AI (free, recommended)

[](#for-local-ai-free-recommended)

- [Ollama](https://ollama.ai) installed and running

ModelRAMDiskBest For`llama3.2`8GB3GBGeneral tasks`qwen2.5-coder`16GB4GBCode generation`mistral`8GB4GBReasoning`deepseek-r1:7b`16GB5GBComplex reasoning### For cloud AI (optional, bring your own key)

[](#for-cloud-ai-optional-bring-your-own-key)

- Anthropic API key — [console.anthropic.com](https://console.anthropic.com)
- OpenAI API key — [platform.openai.com](https://platform.openai.com)
- Or any OpenAI-compatible API (Groq, Together AI, Mistral — all have free tiers)

---

Installation
------------

[](#installation)

```
composer require laragent-dev/laragent-dev
php artisan laragent:install
```

The installer guides you through everything: choosing a provider, installing Ollama if needed, pulling a model, running migrations, and verifying it works.

---

Quick Start
-----------

[](#quick-start)

**Ask anything:**

```
use Laragent\Facades\Agent;

$result = Agent::run('Summarize what our app does based on the database structure');
echo $result->answer;
```

**With database access:**

```
$result = Agent::tools(['database'])
    ->run('How many users signed up this week compared to last week?');
```

**Automate email outreach:**

```
$result = Agent::tools(['database', 'mailer'])
    ->run('Find users who haven\'t logged in for 30 days and send them a re-engagement email');
```

**With persistent memory (multi-turn):**

```
// Turn 1
Agent::tools(['database'])->withMemory('analysis-001')
    ->run('Give me an overview of our sales performance');

// Turn 2 — agent remembers turn 1
Agent::withMemory('analysis-001')
    ->run('Now drill into the top-performing product category');
```

**Multi-agent pipeline:**

```
$result = Agent::pipeline()
    ->step('analyst')
        ->task('Pull our top 10 customers by revenue')
        ->tools(['database'])
        ->passOutputAs('customers')
    ->step('writer')
        ->task('Write a VIP appreciation email for each: {customers}')
        ->tools(['mailer'])
    ->run();

echo $result->finalOutput;
```

---

Built-in Agent Personas
-----------------------

[](#built-in-agent-personas)

Thirteen pre-built agents with tuned system prompts and sensible tool defaults:

PersonaMethodBest ForSupportAgent`Agent::support()`Customer issue resolutionDataAgent`Agent::data()`Business intelligence queriesContentAgent`Agent::content()`Writing and content creationWorkflowAgent`Agent::workflow()`Multi-step automationDevAgent`Agent::dev()`Code generation and dev tasksCodingAgent`Agent::coding()`Implementation and code writingTestingAgent`Agent::testing()`Test generation and QAPlanningAgent`Agent::planning()`Architecture and planningDocumentationAgent`Agent::docs()`Writing docs and API referencesDeploymentAgent`Agent::deploy()`Deployments and DevOps tasksResearchAgent`Agent::research()`Gathering information and factsDesignAgent`Agent::design()`System and component designUiUxAgent`Agent::uiux()`UI/UX design specifications```
// Data analyst — queries DB, returns numbers with context
Agent::data()->run('What\'s our month-over-month user growth rate?');

// Customer support — looks up accounts, sends emails
Agent::support()->run('User ID 42 says they were charged twice last month');

// Content writer — uses HTTP + filesystem
Agent::content()->run('Write 3 subject line options for our Black Friday campaign');

// Developer assistant — filesystem, artisan, HTTP
Agent::dev()->run('Generate a complete CRUD controller for a Product model');

// Workflow automation — database, email, artisan, filesystem
Agent::workflow()->run('Run end-of-month: tally orders, compute revenue, email report to admin@company.com');
```

Extend any persona:

```
Agent::data()
    ->withTools(['mailer'])                          // add tools to defaults
    ->withSystem('Always format numbers with commas.') // append to system prompt
    ->run('Email me the weekly revenue summary');
```

---

Provider Configuration
----------------------

[](#provider-configuration)

### Ollama — Local, Free (default)

[](#ollama--local-free-default)

```
# Install: https://ollama.ai
ollama pull llama3.2
ollama serve
```

```
LARAGENT_PROVIDER=ollama
OLLAMA_MODEL=llama3.2
OLLAMA_HOST=http://localhost:11434
```

### Anthropic Claude

[](#anthropic-claude)

```
LARAGENT_PROVIDER=anthropic
ANTHROPIC_API_KEY=sk-ant-...
ANTHROPIC_MODEL=claude-haiku-4-5
```

### OpenAI and Compatible APIs

[](#openai-and-compatible-apis)

```
# OpenAI
LARAGENT_PROVIDER=openai
OPENAI_API_KEY=sk-...
OPENAI_MODEL=gpt-4o-mini

# Groq (free tier available!)
LARAGENT_PROVIDER=openai
OPENAI_API_KEY=gsk_...
OPENAI_BASE_URL=https://api.groq.com/openai/v1
OPENAI_MODEL=llama-3.3-70b-versatile

# Together AI
OPENAI_BASE_URL=https://api.together.xyz/v1

# Mistral
OPENAI_BASE_URL=https://api.mistral.ai/v1
```

---

Built-in Tools
--------------

[](#built-in-tools)

ToolShort nameDescriptionSecurity`DatabaseTool``database`Read-only Eloquent queriesModel allowlist, no raw SQL`MailerTool``mailer`Send via Laravel MailEmail format validation`HttpTool``http`External API callsSSRF protection, HTTP/HTTPS only`ArtisanTool``artisan`Safe Artisan commandsStrict allowlist`FilesystemTool``filesystem`Read/write sandboxPath traversal blockedYou can use either the short name (`database`) or the full tool name (`database_query`) — both work:

```
Agent::tools(['database', 'mailer'])->run('...');
// same as
Agent::tools(['database_query', 'send_email'])->run('...');
```

### Security defaults

[](#security-defaults)

**DatabaseTool** — read-only, allowlist support:

```
// config/laragent.php
'allowed_models' => ['User', 'Order', 'Product'], // empty = allow all App\Models
```

**HttpTool** — blocks SSRF targets: `127.x`, `10.x`, `192.168.x`, `172.16-31.x`, `169.254.x`, and non-HTTP schemes (`file://`, `ftp://`).

**ArtisanTool** — only commands in the allowlist:

```
'safe_commands' => ['cache:clear', 'config:clear', 'queue:restart', 'view:clear'],
```

**FilesystemTool** — sandboxed to `storage/app/agent-sandbox/`. Path traversal (`..`) and absolute paths are blocked.

---

Creating Custom Tools
---------------------

[](#creating-custom-tools)

```
use Laragent\Tools\BaseTool;
use Illuminate\Support\Facades\Http;

class StripeChargeLookupTool extends BaseTool
{
    public function name(): string
    {
        return 'stripe_charge_lookup';
    }

    public function description(): string
    {
        return 'Look up a Stripe charge by ID or customer email.';
    }

    public function parameters(): array
    {
        return [
            'type'       => 'object',
            'properties' => [
                'charge_id' => ['type' => 'string', 'description' => 'Stripe charge ID (ch_...)'],
                'email'     => ['type' => 'string', 'description' => 'Customer email to search'],
            ],
        ];
    }

    public function execute(array $params): string
    {
        // SECURITY: only accept charge IDs or email, never raw queries
        $chargeId = $params['charge_id'] ?? null;
        $email    = $params['email'] ?? null;

        if (!$chargeId && !$email) {
            return $this->error('Provide either a charge_id or an email.');
        }

        $response = Http::withToken(config('services.stripe.secret'))
            ->get("https://api.stripe.com/v1/charges", array_filter([
                'customer' => $email,
                'limit'    => 5,
            ]));

        if ($response->failed()) {
            return $this->error('Stripe lookup failed: ' . $response->body());
        }

        return json_encode($response->json('data'), JSON_PRETTY_PRINT);
    }
}
```

Register it in a service provider:

```
app(\Laragent\Tools\ToolRegistry::class)->register(new StripeChargeLookupTool());
```

Use it:

```
Agent::tools(['stripe_charge_lookup'])->run('Did user john@example.com get charged twice in November?');
```

---

Testing with AgentFake
----------------------

[](#testing-with-agentfake)

Laragent ships a testing fake — no real AI calls in tests:

```
use Laragent\Facades\Agent;
use Laragent\Testing\AgentFake;

it('sends re-engagement emails to inactive users', function () {
    Agent::fake();
    AgentFake::returns('Found 42 inactive users and sent them re-engagement emails.');

    // Trigger your app code that uses the agent internally
    $this->artisan('app:send-reengagement-emails');

    AgentFake::assertRan();
    AgentFake::assertRanWith('inactive');
    AgentFake::assertToolWasCalled('mailer');
    AgentFake::assertRunCount(1);
});
```

### Assertion API

[](#assertion-api)

MethodDescription`AgentFake::returns(string $answer)`Queue a fake response`AgentFake::assertRan()`Assert agent ran at least once`AgentFake::assertNotRan()`Assert agent never ran`AgentFake::assertRanWith(string $substring)`Assert task contained substring`AgentFake::assertToolWasCalled(string $tool)`Assert tool was requested`AgentFake::assertToolNotCalled(string $tool)`Assert tool was NOT requested`AgentFake::assertRunCount(int $n)`Assert agent ran exactly N times`AgentFake::assertCompleted()`Assert at least one run completed`AgentFake::reset()`Clear all recorded calls---

Interactive CLI
---------------

[](#interactive-cli)

Laragent ships a full interactive CLI — like Claude Code but for your own Laravel app:

```
php artisan laragent:chat
```

Features:

- Persistent conversation memory across turns
- Real-time tool call display
- Slash commands: `/help`, `/exit`, `/clear`, `/tools`, `/agent`, `/provider`, `/swarm`, `/status`
- Switch personas mid-session: `/agent coding`
- Launch swarms: `/swarm Build a REST API for products`
- Speech-to-text input: `/speak` (requires LocalAI)

```
# Start with a specific provider and tools
php artisan laragent:chat --provider=ollama --tools=database --tools=filesystem

# Start as a specific persona
php artisan laragent:chat --agent=coding

# Resume a previous session
php artisan laragent:chat --session=your-session-id
```

---

Multi-Agent Swarm
-----------------

[](#multi-agent-swarm)

Launch multiple specialized agents collaboratively on complex tasks:

```
php artisan laragent:swarm "Build a products inventory management feature"
```

Built-in templates:

TemplateAgentsUse Case`feature` (default)planning, coding, testing, docsFull feature from spec to tests`api`planning, coding, testing, docsREST API with feature tests`frontend`planning, uiux, coding, testingFrontend component with tests`audit`research, docsCode audit and report```
# Choose a template
php artisan laragent:swarm "Add a subscription billing system" --template=api

# Use specific agents in order
php artisan laragent:swarm "Review database schema" --agents=research --agents=documentation

# Or from PHP
use Laragent\Swarm\SwarmOrchestrator;

$orchestrator = new SwarmOrchestrator(app('laragent'));
$swarm = $orchestrator->plan('Build a REST API for orders', 'api');
$result = $swarm->run();

echo $result->finalOutput;
echo $result->summary(); // "Swarm completed: 4 agents, 12 iterations, 8420ms"
```

---

Speech-to-Text (CLI)
--------------------

[](#speech-to-text-cli)

Use your voice as input in `laragent:chat` — completely free, runs locally.

**Recommended: LocalAI** (Ollama-like HTTP server, no Python required):

```
# Install LocalAI with Whisper support
docker run -p 8080:8080 localai/localai:latest whisper

# OR install the binary: https://localai.io
```

```
LARAGENT_STT_DRIVER=localai
LARAGENT_STT_HOST=http://localhost:8080
LARAGENT_STT_MODEL=whisper-1
```

**Alternative: Whisper CLI** (Python-based):

```
pip install openai-whisper
sudo apt install sox  # Linux — for microphone capture
brew install sox      # macOS
```

```
LARAGENT_STT_DRIVER=whisper
LARAGENT_STT_MODEL=tiny
```

Once configured, use `/speak` in the CLI chat to record and transcribe your voice.

---

Artisan Commands
----------------

[](#artisan-commands)

CommandDescription`php artisan laragent:install`Interactive setup wizard`php artisan laragent:chat`Interactive CLI chat session`php artisan laragent:swarm "task"`Multi-agent swarm for complex tasks`php artisan agent:run "task"`Run a single agent task from the terminal`php artisan agent:sessions`List recent agent sessions`php artisan agent:logs {id}`Inspect a session step-by-step```
# Run with tools and custom provider
php artisan agent:run "How many orders are pending?" --tools=database --provider=ollama

# Resume a previous session
php artisan agent:run "Continue the analysis" --memory=session-abc-123
```

---

AgentResponse
-------------

[](#agentresponse)

Every `->run()` returns an `AgentResponse`:

```
$result = Agent::run('...');

$result->answer;       // The agent's final answer
$result->sessionId;    // UUID of the agent session
$result->toolCalls;    // Array of [{tool, params, result}]
$result->iterations;   // Reasoning loop iterations used
$result->tokensUsed;   // Total tokens (input + output)
$result->durationMs;   // Wall-clock time in milliseconds
$result->success;      // true / false

$result->wasSuccessful();  // bool
$result->usedTools();      // bool
$result->summary();        // "Completed in 3 iteration(s), 2 tool call(s), 1240ms"
$result->toArray();        // array
$result->toJson();         // JSON string
```

---

Events
------

[](#events)

```
use Laragent\Events\AgentStarted;
use Laragent\Events\AgentThinking;
use Laragent\Events\AgentToolCalled;
use Laragent\Events\AgentToolResult;
use Laragent\Events\AgentCompleted;
use Laragent\Events\AgentFailed;

Event::listen(AgentCompleted::class, function (AgentCompleted $event) {
    Log::info('Agent completed', [
        'session' => $event->session->id,
        'tokens'  => $event->response->tokensUsed,
        'ms'      => $event->response->durationMs,
    ]);
});
```

---

Configuration Reference
-----------------------

[](#configuration-reference)

```
// config/laragent.php
return [
    'default_provider' => env('LARAGENT_PROVIDER', 'ollama'),

    'providers' => [
        'ollama'    => ['host' => env('OLLAMA_HOST', 'http://localhost:11434'), 'model' => env('OLLAMA_MODEL', 'llama3.2'), 'timeout' => 120],
        'anthropic' => ['api_key' => env('ANTHROPIC_API_KEY'), 'model' => env('ANTHROPIC_MODEL', 'claude-haiku-4-5'), 'timeout' => 60],
        'openai'    => ['api_key' => env('OPENAI_API_KEY'), 'model' => env('OPENAI_MODEL', 'gpt-4o-mini'), 'base_url' => env('OPENAI_BASE_URL', 'https://api.openai.com/v1'), 'timeout' => 60],
    ],

    'max_iterations' => 10,                          // Reasoning loop limit
    'memory_driver'  => env('LARAGENT_MEMORY', 'database'), // database|cache|array
    'log_steps'      => true,                        // Write every step to agent_logs

    'allowed_models' => [],                          // Eloquent model allowlist for DatabaseTool
    'safe_commands'  => ['cache:clear', 'config:clear', 'queue:restart', 'view:clear'],
    'sandbox_path'   => 'agent-sandbox',             // FilesystemTool sandbox (storage/app relative)
];
```

---

Sponsorship
-----------

[](#sponsorship)

Laragent is MIT licensed and free forever. If it saves you hours on a client project, consider sponsoring:

TierAmountBenefitSupporter$5/moName in READMEBacker$25/moLogo in READMESilver Sponsor$100/moLogo on laragent.devGold Sponsor$500/moLogo + blog post about your product- [Sponsor on GitHub](https://github.com/sponsors/laragent-dev)
- [Laragent Pro](https://laragent.dev) — visual flow builder, analytics, Pro tool library ($10/mo)

---

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

[](#contributing)

See [CONTRIBUTING.md](CONTRIBUTING.md) for the full guide. Quick start:

```
git clone https://github.com/laragent-dev/laragent-dev.git
cd laragent
composer install
./vendor/bin/pest      # run tests
./vendor/bin/pint      # fix code style
```

- Bug reports and feature requests: [open an issue](https://github.com/laragent-dev/laragent-dev/issues)
- Security vulnerabilities: email `security@laragent.dev` (do not open a public issue)
- Questions and discussion: [GitHub Discussions](https://github.com/laragent-dev/laragent-dev/discussions)

---

Community
---------

[](#community)

- [GitHub Discussions](https://github.com/laragent-dev/laragent-dev/discussions) — questions, ideas, show and tell
- [GitHub Issues](https://github.com/laragent-dev/laragent-dev/issues) — bugs and feature requests
- [laragent.dev](https://laragent.dev) — website and Pro plan

---

Code of Conduct
---------------

[](#code-of-conduct)

This project follows the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). By participating you agree to abide by its terms.

---

Security
--------

[](#security)

See [SECURITY.md](SECURITY.md) for the vulnerability disclosure policy and an overview of Laragent's security model.

---

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md) for release history.

---

License
-------

[](#license)

MIT — free to use in commercial projects. Copyright (c) 2024 Laragent ([laragent.dev](https://laragent.dev))

###  Health Score

37

—

LowBetter than 82% of packages

Maintenance94

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

61d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/73abab9c5c521bcc0882b2e534e64ed7ee4620d0aac5f689f525d9ea60db4e60?d=identicon)[raihan-js](/maintainers/raihan-js)

---

Top Contributors

[![raihan-js](https://avatars.githubusercontent.com/u/48921536?v=4)](https://github.com/raihan-js "raihan-js (6 commits)")

---

Tags

laravelautomationaiopenaiagentsllmanthropicollama

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/laragent-dev-laragent-dev/health.svg)

```
[![Health](https://phpackages.com/badges/laragent-dev-laragent-dev/health.svg)](https://phpackages.com/packages/laragent-dev-laragent-dev)
```

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[toponepercent/baum

Baum is an implementation of the Nested Set pattern for Eloquent models.

3154.7k](/packages/toponepercent-baum)

PHPackages © 2026

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