Skip to main content
LarAgent brings Laravel-grade productivity to the world of AI agents - combining the speed and structure Laravel developers love with powerful agentic capabilities. Together, Laravel + LarAgent form the most productive stack available for building AI agents today. It is backed by Redberry, one of only 10 Diamond-tier Laravel partners. This partnership allows LarAgent to scale development and stay open-source - while also giving teams the option to get hands-on help with AI agent implementation.
Need help building your AI agents? Talk to us about our 5-week PoC sprint for AI agent development.

What is LarAgent?

What if you can create AI agents just like you create any other Eloquent model? Why not?! πŸ‘‡
php artisan make:agent YourAgentName
And it looks familiar, isn’t it?
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;
    }
}

And you can tweak the configs, like history
// ...
protected $history = \LarAgent\History\CacheChatHistory::class;
// ...
Or add temperature:
// ...
protected $temperature = 0.5;
// ...
Oh, and add a new tool:
// ...
#[Tool('Get the current weather in a given location')]
public function exampleWeatherTool($location, $unit = 'celsius')
{
    return 'The weather in '.$location.' is '.'20'.' degrees '.$unit;
}
// ...
And run it, per user:
Use App\AiAgents\YourAgentName;
// ...
YourAgentName::forUser(auth()->user())->respond($message);
Or use your custom name for the chat history:
Use App\AiAgents\YourAgentName;
// ...
YourAgentName::for("custom_history_name")->respond($message);
Let’s check the quickstart page πŸ‘