Understanding engine
LarAgentâs core functionality is powered by theLarAgent\LarAgent class, often referred to as the âLarAgent engine.â This engine is a standalone component that contains all the abstractions and doesnât depend on Laravel. It manages agents, tools, chat histories, structured output, and other core features.
Getting Started
To use LarAgent outside of Laravel, youâll need to handle some configuration and initialization manually:Configuring Structured Output
You can define structured output schemas to get responses in a specific format:Adding Tools
You can add tools to the agent using theTool class:
Use Chat History
Outside of Laravel, youâll need to create and pass chat history instance into setup method:JsonChatHistoryInMemoryChatHistory
Differences from Laravel Usage
When using LarAgent outside of Laravel, be aware of these key differences:Manual Configuration
You need to provide all configuration directly instead of using Laravelâs config system.
No Artisan Commands
You wonât have access to the helpful artisan commands for generating agents and tools.
LangChain-like usage
Instead of classes, you will create Agents using
LarAgent::setup()No Service Container
You canât leverage Laravelâs service container for dependency injection.
Future Plans
As mentioned at the top of this page, LarAgent will soon separate its core engine into a standalone package. This will provide a cleaner, more focused API for non-Laravel projects while maintaining full compatibility with the current methods and functions.
- Improved documentation specifically for non-Laravel usage
- Simplified installation for PHP projects
- Reduced dependencies
- The same powerful features youâre used to in LarAgent

