Code review at scale is broken. Here’s how Augment Code is fixing it.

The Laravel Way to Build AI Agents That Actually Work

Published on by

The Laravel Way to Build AI Agents That Actually Work image

After integrating AI into dozens of Laravel applications, a pattern emerges: teams spend 20% of their time making AI work and 80% making sure it doesn't break. Every project reinvents the same wheels – session management, tool calling, prompt testing, error handling.

There's now a better way.

Vizra ADK brings software engineering principles to AI development in Laravel. Not just another API wrapper, but a complete framework for building, testing, and deploying intelligent agents that teams can actually trust in production.

Think Laravel's elegance meets AI's power. Controllers for agents. Migrations for memory. Tests for prompts. Everything developers love about Laravel, now for AI.

Free, open source, and built the Laravel way.

From Zero to AI Agent in Under 2 Minutes

Let's build something real. Fire up your terminal:

composer require vizra/vizra-adk
php artisan vizra:install

Add your AI provider key to .env:

OPENAI_API_KEY=your-key-here
# Also supports Anthropic, Google Gemini + many more

Now create your first agent:

php artisan vizra:make:agent CustomerSupportAgent

That's it! You've just created an intelligent AI assistant. Let's make it useful:

<?php
 
namespace App\Agents;
 
use Vizra\VizraADK\Agents\BaseLlmAgent;
 
class CustomerSupportAgent extends BaseLlmAgent
{
protected string $name = 'customer_support';
 
protected string $description = 'Handles customer inquiries with empathy and efficiency';
 
protected string $instructions = "You are a helpful customer support agent for AcmeStore.
 
Key information:
- We sell electronics and gadgets
- Free shipping on orders over $50
- 30-day return policy
- Business hours: 9 AM - 6 PM EST
 
Be friendly, professional, and solution-oriented.";
 
protected string $model = 'gpt-3.5-turbo';
}

Test Your Agent Instantly!

Want to see your agent in action? You have three ways to test it immediately:

# 1. Command line chat
php artisan vizra:chat customer_support
 
# 2. Beautiful web dashboard (with trace debugging!)
# Visit: http://your-app.test/vizra
 
# 3. Built-in API endpoints (no controller needed!)
curl -X POST http://your-app.test/api/vizra-adk/interact \
-H "Content-Type: application/json" \
-d '{"agent_name": "customer_support", "input": "Hello!"}'

That's right – Vizra ADK includes ready-to-use API endpoints. No need to write controllers unless you want custom logic.

Of course, if you prefer the traditional approach:

// In your controller (optional)
use App\Agents\CustomerSupportAgent;
 
public function chat(Request $request)
{
$response = CustomerSupportAgent::run($request->input('message'))
->forUser(auth()->user())
->go();
 
return response()->json(['reply' => $response]);
}

Your agent automatically maintains conversation history per user. No session management headaches.

Give Your Agents Superpowers with Tools

Here's where it gets exciting. Your agents can actually do things, not just chat:

php artisan vizra:make:tool OrderLookupTool
<?php
 
namespace App\Tools;
 
use Vizra\VizraADK\Contracts\ToolInterface;
use Vizra\VizraADK\System\AgentContext;
use Vizra\VizraADK\Memory\AgentMemory;
 
class OrderLookupTool implements ToolInterface
{
public function definition(): array
{
return [
'name' => 'order_lookup',
'description' => 'Look up customer order by order ID',
'parameters' => [
'type' => 'object',
'properties' => [
'order_id' => [
'type' => 'string',
'description' => 'The order ID to look up',
],
],
'required' => ['order_id'],
],
];
}
 
public function execute(array $arguments, AgentContext $context, AgentMemory $memory): string
{
$order = Order::find($arguments['order_id']);
 
if (!$order) {
return json_encode(['error' => 'Order not found']);
}
 
// Store this interaction in memory
$memory->addFact("Recent order lookup: #{$order->id}", 1.0);
 
return json_encode([
'order_id' => $order->id,
'status' => $order->status,
'total' => $order->total,
'items' => $order->items->count(),
]);
}
}

Connect the tool to your agent:

class CustomerSupportAgent extends BaseLlmAgent
{
protected array $tools = [
OrderLookupTool::class,
];
}

Now your agent can look up real orders when customers ask. No more "I'm just an AI" excuses.

The Game Changer: Test Your AI Like You Test Your Code

Here's what sets Vizra apart from every other Laravel AI package – evaluations. Just like you wouldn't ship code without tests, why ship AI without quality assurance?

php artisan vizra:make:eval CustomerSupportQuality

This creates both your evaluation class AND a CSV file for test cases. Add some real-world scenarios:

prompt,expected_response,description
"Where is my order #12345?",order,"Should look up order status"
"I want to return this",return,"Should explain return policy"
"Your service is terrible!",sorry,"Should respond with empathy"
"What are your hours?",9 AM,"Should mention business hours"

Now define what "quality" means for your agent using Vizra's built-in assertions:

<?php
 
namespace App\Evaluations;
 
use Vizra\VizraADK\Evaluations\BaseEvaluation;
 
class CustomerSupportQuality extends BaseEvaluation
{
public string $agentName = 'customer_support';
public string $csvPath = 'app/Evaluations/data/customer_support_quality.csv';
 
public function evaluateRow(array $csvRowData, string $llmResponse): array
{
$this->resetAssertionResults();
 
// Check if response contains expected keywords
if (isset($csvRowData['expected_response'])) {
$this->assertResponseContains(
$llmResponse,
$csvRowData['expected_response']
);
}
 
// All support responses should be polite
$this->assertResponseHasPositiveSentiment($llmResponse);
 
// Don't write novels
$this->assertWordCountBetween($llmResponse, 20, 150);
 
// For complaints, ensure empathy
if (str_contains($csvRowData['prompt'], 'terrible')) {
$this->assertResponseContains($llmResponse, 'sorry');
}
 
return parent::evaluateRow($csvRowData, $llmResponse);
}
}

Notice those assertion methods? Vizra ADK includes 20+ built-in assertions for content validation, sentiment analysis, length checks, and more. No need to write complex validation logic – just use assertions like assertResponseHasPositiveSentiment() or assertWordCountBetween(). And yes, you can add your own custom assertions too!

Run your quality checks:

php artisan vizra:run:eval CustomerSupportQuality
 
Running evaluation: customer_support_quality
Processing 4 test cases...
████████████████████████ 4/4
 
Summary: Total: 4, Passed: 3 (75%), Failed: 1

One test failed the word count check – the agent wrote 180 words when explaining the return policy. This is exactly why you need evaluations! Now you can tune your agent's instructions to be more concise, or adjust your assertions to match your actual requirements.

Built by Developers, for Developers

Vizra ADK isn't just another package – it's a complete AI development framework:

  • 🚀 Native Laravel Integration - Artisan commands, facades, service providers
  • 🔧 Multi-LLM Support - OpenAI, Anthropic Claude, Google Gemini (and 10+ more via Prism)
  • 🧠 Smart Memory - Sessions, vector search, and RAG built-in
  • 🤝 Agent Delegation - Agents can work together, delegating tasks to specialized sub-agents
  • ⚡ Workflows - Orchestrate complex multi-step processes with conditional logic
  • 🧪 Built-in Testing - Evaluations framework with 20+ assertions for quality assurance
  • 📊 Web Dashboard - Beautiful UI for testing and monitoring at /vizra
  • 🔌 OpenAI Compatible API - Drop-in replacement for any OpenAI SDK
  • 🎯 Developer Friendly - Streaming responses, comprehensive tracing, detailed error messages

Start Building Today (It's Free!)

composer require vizra/vizra-adk

The entire framework is open source and MIT licensed. Build agents for customer support, data analysis, content generation, or anything else you can imagine.

Want to Scale? There's Vizra Cloud (Coming Soon)

While the ADK is forever free, we're launching Vizra Cloud for teams who want:

  • Run evaluations at scale in the cloud
  • Track quality metrics across deployments
  • Collaborate with your team on agent development
  • CI/CD integration for continuous AI quality

Beta pricing: $29/month (50% off regular pricing, locked in for 12 months).

Your AI Journey Starts Now

Stop wrestling with AI APIs. Stop hoping your AI behaves. Start building AI agents the Laravel way – with proper tools, testing, and confidence.

Ready to build something amazing?

🚀 Get Started with Vizra ADK
📖 Read the Docs
Star us on GitHub


Vizra ADK is the creation of indie developer Aaron Lumsden. Built with love for the Laravel community.

Aaron Lumsden photo

👋 Full-stack web dev by day, Indie Hacker by night. ✨ Creating software to make the 🌍 a better place. 🤖 Founder @ http://vizra.ai | Building AI agents for Laravel

Filed in:
Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Jump24 - UK Laravel Agency

Laravel Developers that Click into Place. Never outsourced. Never offshored. Always exceptional.

Visit Jump24 - UK Laravel Agency
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $3200/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit

The latest

View all →
Laravel Related Content: Semantic Relationships Using pgvector image

Laravel Related Content: Semantic Relationships Using pgvector

Read article
Filament v5.2.0 Adds a Callout Component image

Filament v5.2.0 Adds a Callout Component

Read article
OpenAI Releases GPT-5.3-Codex, a New Codex Model for Agent-Style Development image

OpenAI Releases GPT-5.3-Codex, a New Codex Model for Agent-Style Development

Read article
Claude Opus 4.6 adds adaptive thinking, 128K output, compaction API, and more image

Claude Opus 4.6 adds adaptive thinking, 128K output, compaction API, and more

Read article
Laravel Announces Official AI SDK for Building AI-Powered Apps image

Laravel Announces Official AI SDK for Building AI-Powered Apps

Read article
`hasMany()` Collection Method in Laravel 12.50.0 image

`hasMany()` Collection Method in Laravel 12.50.0

Read article