Skip to main content
Back to packages
637 GitHub stars

MaestroError/LarAgent

View on GitHub

Description

The easiest way to create and maintain AI agents in your Laravel projects.

LarAgent brings the power of AI agents to your Laravel projects with an elegant syntax. Create, extend, and manage AI agents with ease while maintaining Laravel's fluent API design patterns.

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;
// ...

Even disable parallel tool calls:

// ...
protected $parallelToolCalls = false;
// ...

Recent Courses on Laravel Daily

Roles and Permissions in Laravel 13

14 lessons
57 min

Laravel 13 Eloquent: Expert Level

41 lessons
1 h 34 min

How to Structure Laravel 13 Projects

16 lessons
1 h 32 min read

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.