๐๐๐ถ๐น๐ฑ ๐ฎ ๐ฅ๐ฒ๐๐ฐ๐ ๐๐ต๐ฎ๐ ๐๐ด๐ฒ๐ป๐ ๐๐ถ๐๐ต ๐๐ฎ๐ฟ๐ฎ๐๐ฒ๐น ๐๐ ๐ฆ๐๐
You build a smart chat assistant with the Laravel AI SDK.
The stack uses:
- PHP 8.5
- Laravel 13
- Livewire 4
- Laravel AI SDK
Most models guess. ReAct models reason and act.
Here is the loop:
- Reason: The model thinks about the need.
- Act: It calls a tool for real data.
- Observe: The tool returns a result.
- Repeat: The model uses the result to answer.
You need four main things:
- Agent: A class with prompts and tools.
- Tool: A class for a specific task.
- Streaming: Real-time responses.
- Memory: Chat history in your database.
The SDK runs the loop for you. You define the tools. The SDK handles the rest.
It uses Prism for the low level work. The AI SDK gives you a high level API.
The result is a fast chat app. It uses real tools for math and web searches.
Source: https://dev.to/tomshaw/building-a-react-chat-agent-with-the-laravel-ai-sdk-4ip6