Skip to main content

Requirements

Before installing LarAgent, make sure your environment meets the following requirements:

Installation

You can install LarAgent via Composer:
After installing the package, publish the configuration file:
This will create a config/laragent.php file in your application.

Configuration

OpenAi

If you are using OpenAI API, just set your API key in your .env file and you are good to go:

Configuration file

The published configuration file contains the following settings and default providers:
Configuration file provided below is an example, please refer to the latest version of config file.

Custom Providers

You can configure additional providers with custom settings:

Creating Your First Agent

Using Artisan Command

The quickest way to create a new agent is using the provided Artisan command:
This will create a new agent class in the App\AiAgents directory with all the necessary boilerplate code.

Basic Usage

Simple Response

Adding Tools

Tools allow your agent to perform actions and access external data:

Next Steps

Now that you have LarAgent set up, you can explore more advanced features:

Agents

Learn more about creating and configuring agents

Tools

Discover how to create powerful tools for your agents

Structured Output

Get responses in structured formats like JSON

Streaming

Stream responses in real-time for better UX