# LarAgent: an Eloquent-style agent framework for Laravel

> LarAgent is an MIT-licensed Laravel package that turns agents into classes you generate with an artisan command. It is a good fit for Laravel teams already fluent in Eloquent; it is a poor fit for anyone who does not want agent definitions living in PHP classes.

**MaestroError/LarAgent** — Power of AI Agents in your Laravel project

- Repository: https://github.com/MaestroError/LarAgent
- Website: https://laragent.ai/
- Stars: 645 · Forks: 57
- Language: PHP
- License: MIT
- Published: 2026-09-10 · Updated: 2026-09-10 · Language: en
- Canonical page: https://hysenlabs.com/projects/maestroerror-laragent

## The problem LarAgent solves for Laravel teams

Most agent tooling is written for Python or TypeScript, which means a Laravel team either runs a second service or writes a thin HTTP wrapper around someone else's runtime. LarAgent takes the opposite position: the agent is a PHP class inside your application. The README states the project is "the easiest way to create and maintain AI agents in your Laravel projects", and the design follows that claim literally. You get an artisan generator, a base Agent class, and configuration expressed as protected properties on the class.

The audience is narrow and identifiable. If your product is a Laravel application, and the people who will maintain the agent are the same people who maintain your models, policies and jobs, then keeping the agent in the same repository removes a deployment boundary. If your team is polyglot and the agent is a separate product with its own release cycle, that same coupling becomes a liability, because agent changes then ship on your application's deploy cadence.

LarAgent is MIT licensed and the repository is not archived. The last push was on 2026-08-20, so the project is current as of the time of writing, though the README itself does not describe a support policy or a release cadence.

## How an agent class maps to providers, tools and history

The mechanism is a class that extends LarAgent\Agent and declares its behaviour through protected properties and two methods. The README example sets $model, $history, $provider and $tools, then implements instructions() and prompt($message). Nothing is registered in a service provider by hand; the class is the configuration.

History is pluggable. The README shows the string 'in_memory' as a default and LarAgent\History\CacheChatHistory::class as an alternative, and it also shows calling an agent with a custom history name via for("custom_history_name"). That means conversation state can be scoped to a user or to an arbitrary key, which is the part that matters when two requests for the same user arrive at once.

Tools are declared with a PHP attribute. The README example annotates a public method with #[Tool('Get the current weather in a given location')] and returns a string. The framework reads the attribute and the method signature, so the parameter list is the tool schema.

Provider selection is where the design gets more interesting than a single string. The README shows $provider as an array, where the first entry is primary and later entries are fallbacks, and it supports per-provider overrides: 'gemini' => ['model' => 'gemini-2.0-flash']. Failover is therefore a property of the agent class, not something you write in a try/catch around a call.

## Installing LarAgent and running a first agent

The README does not reproduce the composer command inline; it points to docs.laragent.ai/introduction and to a Medium article for getting started, and the Packagist badge identifies the package as maestroerror/laragent. The generator command is shown explicitly, so the practical path is: require the package, publish whatever configuration the install step offers, then generate an agent.

The generator is the entry point. Running it in a Laravel application creates the agent class for you:

```bash
php artisan make:agent YourAgentName
```

The README shows the generated class under the App\AiAgents namespace. Its shape is short enough to read in full: a model, a history setting, a provider, a tools array, and the two methods.

```php
namespace App\AiAgents;

use LarAgent\Agent;

class YourAgentName extends Agent
{
    protected $model = 'gpt-4';

    protected $history = 'in_memory';

    protected $provider = 'default';

    protected $tools = [];

    public function instructions()
    {
        return "Define your agent's instructions here.";
    }

    public function prompt($message)
    {
        return $message;
    }
}
```

To call it, the README uses a static entry point and scopes the conversation to the authenticated user, which is what makes the history setting meaningful rather than decorative:

```php
use App\AiAgents\YourAgentName;

YourAgentName::forUser(auth()->user())->respond($message);
```

Adding a tool means adding a method with the Tool attribute. The README's weather example returns a hardcoded string, which is a placeholder rather than a working integration, so replace the body with your own call.

```php
#[Tool('Get the current weather in a given location')]
public function exampleWeatherTool($location, $unit = 'celsius')
{
    return 'The weather in '.$location.' is '.'20'.' degrees '.$unit;
}
```

Other knobs are set the same way: $temperature = 0.5, and $parallelToolCalls = false to disable parallel tool calls. The README does not document what the default provider configuration contains, so the 'default' provider string has to be resolved against the published config file, which the README does not show.

## Where LarAgent is the wrong tool

The README is a landing page, not a manual. It lists features such as structured output, image input, an event system and OpenAI-compatible API exposure, but it does not show the configuration for any of them, and it does not document failure behaviour for the parts it does show. If you need to know what happens when a fallback provider in the $provider array also fails, the README does not say. If you need to know how in_memory history behaves across queued jobs, the README does not say.

That matters because the framework leans on Laravel's queue system for multi-agent workflows, and the README claims "multi-agent workflows with queues, chainable tasks, and reasoning" without describing the queue topology. A team that adopts LarAgent expecting the README to answer operational questions will be reading docs.laragent.ai instead.

The second mismatch is architectural. If your agents must be callable from a non-PHP service, or if your organisation standardises on a Python agent framework for evaluation and tracing, LarAgent puts the logic in the wrong place. The OpenAI-compatible schema mentioned in the feature list is an exposure layer, not a substitute for a shared runtime.

A third case: if your application is not Laravel, the package's main advantage disappears. The Eloquent-like API is only an advantage to people who already think in Eloquent.

## How LarAgent differs from Vizra ADK, Neuron and Prism

The related searches around this project name Vizra ADK, Neuron, and Echolabsdev Prism, all PHP-side options, so the realistic comparison is within PHP rather than against Python frameworks.

LarAgent's distinguishing choice is that the agent is a generated class with protected properties, and provider failover is expressed as an array on that class. A library that presents agents as configuration arrays or as fluent builders keeps agent definitions out of the class hierarchy and makes them easier to construct dynamically at runtime. LarAgent gives up that dynamism for the familiarity of a class you can open, read and version.

The second difference is scope. Prism is known in the Laravel ecosystem as a provider-abstraction layer, meaning the unit of work is an LLM call. LarAgent's unit of work is an agent with instructions, history and tools, and the README adds multi-agent workflows and an MCP client as a separate ecosystem package. If you only need to call a model and get text back, an agent framework is more machinery than the problem requires.

MCP support is listed as a first-class feature and the ecosystem section points to a separate mcp-client-laravel repository, which means the MCP integration is not fully contained in this package. Release 1.4.0 is titled "Laravel 13 support and MCP client update", so the two move together.

## Maintenance, releases and what the MIT licence leaves you to decide

The repository is not archived and the most recent push was on 2026-08-20. Three releases are listed: 1.4.0 on 2026-05-09 for Laravel 13 support and an MCP client update, 1.3.0 on 2026-03-25 for the OpenAI Responses API, and 1.2.2 on 2026-03-11 for Gemini streaming and empty tool_use fixes. The spacing suggests a project that ships when a provider API changes rather than on a fixed schedule.

The practical upgrade cost is tied to your provider mix. If you use Gemini streaming or the OpenAI Responses API, the changelog entries above are the ones that touched your code path. If you pin a Laravel version older than 13, check which LarAgent release still supports it before upgrading, because 1.4.0 is the release that added Laravel 13 support and the README does not publish a compatibility matrix.

The licence is MIT. That permits commercial use and modification, but it also means the maintainers carry no obligation to fix your provider outage, and the README's commercial offering is a separate five-week proof-of-concept sprint from Redberry rather than a support contract attached to the package. Whether you need that is a procurement question, not a technical one, and nothing in the repository answers it.

## Conclusion

Adopt LarAgent if your application is already Laravel and you want agent definitions to sit next to your models and jobs, generated with php artisan make:agent and versioned like any other class. Do not adopt it if you need a language-agnostic agent runtime, or if you expect the README to answer operational questions: it does not document rollback, queue worker sizing or cost controls, and it points to docs.laragent.ai for anything beyond the first example. Before committing, verify two things in your own environment: that the provider you intend to use is supported by the version you install, and that your chosen history backend behaves as you expect under concurrent requests, because the README only shows in_memory, CacheChatHistory and named histories without describing their failure modes. The last push to the repository was on 2026-08-20, and release 1.4.0 added Laravel 13 support and an MCP client update.

## FAQ

### What is LarAgent used for?

LarAgent is an AI agent development framework for Laravel. It lets you define agents as PHP classes with a model, a history setting, a provider and tools, then call them from your application code.

### How do I install LarAgent in a Laravel project?

The README does not show the composer command inline. It points to docs.laragent.ai/introduction for installation and configuration, and the Packagist badge identifies the package as maestroerror/laragent, which is the name you would require.

### How do I create an agent with LarAgent?

Run php artisan make:agent YourAgentName. The README shows the generated class under App\AiAgents extending LarAgent\Agent, with instructions() and prompt($message) methods you fill in.

### Does LarAgent support fallback between AI providers?

Yes. The README shows $provider as an array where the first entry is primary and later entries are fallbacks in order, and it allows per-provider overrides such as 'gemini' => ['model' => 'gemini-2.0-flash'].

### What licence does LarAgent use?

LarAgent is released under the MIT licence, and the repository contains a LICENSE.md file.

## Sources

- [License: MIT](https://github.com/MaestroError/LarAgent/blob/main/LICENSE)
- [MaestroError/LarAgent on GitHub](https://github.com/MaestroError/LarAgent)
- [Project website](https://laragent.ai/)
- [README](https://github.com/MaestroError/LarAgent/blob/main/README.md)
- [Releases](https://github.com/MaestroError/LarAgent/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/maestroerror-laragent
