Repolode
MaestroError

MaestroError/LarAgent

A PHP framework for building AI agents in Laravel projects, with an Eloquent-style API, tools, chat history and multi-provider support.

Stars
645
Forks
56
Open issues
7
Last commit
3 months ago

What is it?

LarAgent is a framework for creating AI agents inside Laravel applications. Agents are defined as classes that look much like Eloquent models, with properties for the model, provider, chat history and tools, plus an artisan command to generate them. Developers can attach tools as attribute-annotated methods or classes, and run an agent per user or under a custom history name.

The framework covers the common building blocks of agent work: multiple chat history backends such as in-memory and cache storage, structured output, image input, and parallel tool calls that can be turned off. Providers can be configured per agent, and an ordered provider list gives automatic failover to fallback providers. An event system exposes hooks across agent interactions, and agents can be exposed through an OpenAI-compatible API. It also supports MCP servers as a tool source.

LarAgent requires PHP 8.3 or higher and Laravel 10.x or higher, and it can also be used outside Laravel in standalone mode. It is distributed as the maestroerror/laragent Composer package under the MIT license.

Key features

  • 01Define agents as Eloquent-style classes generated with an artisan command.
  • 02Attach tools as annotated methods or classes, with optional parallel execution.
  • 03Store chat history in memory, cache, JSON and other backends, per user or by custom name.
  • 04Automatic failover across an ordered list of LLM providers.
  • 05Structured output and image input support.
  • 06Event hooks across agent interactions and an OpenAI-compatible API exposure.

Use cases

  • Adding a conversational assistant to an existing Laravel product.
  • Automating internal operations with agents that call application tools.
  • Building per-user chat experiences with stored conversation history.
  • Running agents with fallback providers to reduce downtime from a single LLM vendor.

Quick start

  1. 1

    Install the package with Composer

    composer require maestroerror/laragent
  2. 2

    Publish the config file

    php artisan vendor:publish --tag="laragent-config"
  3. 3

    Generate your first agent

    php artisan make:agent YourAgentName

Things to know

  • Requires Laravel 10.x or higher and PHP 8.3 or higher.
  • Needs an API key from an LLM provider such as OpenAI to run agents.

In collections

Topics

FAQ

What is LarAgent?
A PHP framework for building AI agents in Laravel projects, with an Eloquent-style API, tools, chat history and multi-provider support. LarAgent is a framework for creating AI agents inside Laravel applications. Agents are defined as classes that look much like Eloquent models, with properties for the model, provider, chat history and tools, plus an artisan command to generate them. Developers can attach tools as attribute-annotated methods or classes, and run an agent per user or under a custom history name.
Is LarAgent free to use? What license does it have?
LarAgent is open source under the MIT license. Check the license terms before using it in commercial products.
Is LarAgent still maintained?
Updated within 6 months. The last commit to LarAgent was on Aug 20, 2026.
What can I use LarAgent for?
Adding a conversational assistant to an existing Laravel product. Automating internal operations with agents that call application tools. Building per-user chat experiences with stored conversation history. Running agents with fallback providers to reduce downtime from a single LLM vendor.
How do I install LarAgent?
Install the package with Composer: composer require maestroerror/laragent Publish the config file: php artisan vendor:publish --tag="laragent-config" Generate your first agent: php artisan make:agent YourAgentName
Where can I get LarAgent?
The source code and installation instructions are on GitHub: https://github.com/MaestroError/LarAgent

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects