LarAgent v1.0 – Production-Ready AI Agents for Laravel

https://blog.laragent.ai/content/images/size/w1200/2026/01/ChatGPT-Image-Jan-22–2026–03_15_35-PM.png

This major release takes LarAgent to the next level – focused on structured responses, reliable context management, richer tooling, and production-grade agent behavior.

Designed for both development teams and business applications where predictability, observability, and scalability matter

🛠️ Structured Outputs with DataModel

LarAgent introduces DataModel-based structured responses, moving beyond arrays to typed, predictable output shapes you can rely on in real apps.

What it means

  • Type-safe outputs — no more guessing keys or parsing unstructured text
  • Responses conform to a defined schema, you receive DTO-like object as response as well as tool arguments
  • Easier integration with UIs, APIs, and automated workflows
  • Full support for nesting, collections, nullables, union type and everything you need to define structure of any complexity

Example

use LarAgent\Core\Abstractions\DataModel;
use LarAgent\Attributes\Desc;

class WeatherResponse extends DataModel
{
    #[Desc('Temperature in Celsius')]
    public float $temperature;

    #[Desc('Condition (sunny/cloudy/etc.)')]
    public string $condition;
}

class WeatherAgent extends Agent
{
    protected $responseSchema = WeatherResponse::class;
}

$response = WeatherAgent::ask('Weather in Tbilisi?');
echo $response->temperature;

🗄️ Storage Abstraction Layer

v1.0 introduces a pluggable storage layer for chat history and context, enabling persistent, switchable, and scalable storage drivers.

What’s new

  • Eloquent & SimpleEloquent drivers included
  • Swap between memory, cache, or database without rewriting agents
  • Fallback mechanism with one primary and multiple secondary drivers
class MyAgent extends Agent
{
    protected $history = [
        CacheStorage::class,  // Primary: read first, write first
        FileStorage::class,   // Fallback: used if primary fails on read
    ];
}

🔄 Intelligent Context Truncation

Long chats are inevitable, but hitting token limits shouldn’t be catastrophic. LarAgent now provides smart context management strategies.

Available strategies

  • Sliding Window: drop the oldest messages
  • Summarization: compress context using AI summaries
  • Symbolization: replace old messages with symbolic tags
class MyAgent extends Agent
{
    protected $enableTruncation = true;
    protected $truncationThreshold = 50000;
}

👉 Save on token costs while preserving context most relevant to the current conversation.

🧠 Enhanced Session + Identity Management

Context now supports identity-based sessions which is created by user id, chat name, agent name and group. Identity storage holds all identity keys that makes context of any agent available via the Context facade to manage. For example:

Context::of(MyAgent::class)
    ->forUser($userId)
    ->clearAllChats();

✔ Better support for multi-tenant SaaS, shared agents, and enterprise apps.

Generate fully-formed custom tool classes with boilerplate and IDE-friendly structure

php artisan make:agent:tool WeatherTool

This generates a ready tool with name, description, and handle() stub. Ideal for quickly adding capabilities to your agents.

Now the CLI chat shows tool calls as they happen — invaluable when debugging agent behavior.

You: Find me Laravel queue docs
Tool call: web_search
Tool call: extract_content

Agent: Here’s the documentation…

👉 Easier debugging and More transparency into what your agent actually does

MCP (Model Context Protocol) tools now support automatic caching.

Why it matters

  • First request fetches tool definitions from servers
  • Subsequent requests use cached definitions
  • Significantly faster agent initialization

Add to .env:

MCP_TOOL_CACHE_ENABLED=true
MCP_TOOL_CACHE_TTL=3600
MCP_TOOL_CACHE_STORE=redis

Clear with:

php artisan agent:tool-clear

✔ Great for production systems where latency matters

📊 Usage Tracking

Track prompt tokens, completion tokens, and usage stats per agent — ideal for cost analysis and billing

$agent = MyAgent::for('user-123');
$usage = $agent->usageStorage();

$totalTokens = $usage->getTotalTokens();

Usage tracking is based on session identity – it means that you can check token usage by user, by agent and/or by chat – allowing you to implement comprehensive statistics and reporting capabilities.


⚠️ Breaking Changes

v1.0 includes a few breaking API changes. Make sure to check the migration guide.


🧩 Summary — v1.0 Highlights

Production-focused improvements:

  • 🧱 Structured DataModel outputs
  • 📦 Storage abstraction (Eloquent & persistent drivers)
  • 🤖 Truncation strategies for stable contexts
  • 👥 Identity-aware sessions & Context Facade
  • 🔧 Better tooling & CLI observability
  • ⚡ MCP caching and usage tracking

LarAgent v1.0 is all about reliability, predictability, and scale — turning AI agents into first-class citizens of your Laravel application.

Happy coding! 🚀

Laravel News Links