AWS Bedrock provider for the Laravel AI SDK. Connect your Laravel agents to Claude, OpenAI, Meta Llama, Amazon Nova, and other models running on AWS Bedrock using IAM authentication (SigV4 signing) instead of API keys.
- PHP 8.4+
- Laravel 13+
laravel/ai^0.8prism-php/prism^0.100aws/aws-sdk-php^3.0
composer require jayi/kaleidoscopePublish the config file (optional):
php artisan vendor:publish --tag=kaleidoscope-configAdd a bedrock provider to your config/ai.php:
'providers' => [
// ...existing providers...
'bedrock' => [
'driver' => 'bedrock',
'region' => env('AWS_BEDROCK_REGION', 'us-east-1'),
'profile' => env('AWS_BEDROCK_PROFILE'),
'credentials' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'token' => env('AWS_SESSION_TOKEN'),
],
],
],Then set your environment variables:
AWS_BEDROCK_REGION=us-east-1
AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key| Document | Description |
|---|---|
| Installation | Setup, configuration, environment variables, authentication methods |
| Text Generation | Agents, inline prompts, streaming, model selection |
| Models | Anthropic, OpenAI, Mistral, Converse universal provider |
| Embeddings | Amazon Titan Embed, Cohere Embed models and usage |
| Images | Nova Canvas, Titan Image, Stability AI generation |
| Reranking | Cohere Rerank, Amazon Rerank via Agent Runtime |
| Attachments | Image and document attachments, support matrix |
| Extending | Adding new model providers, architecture overview |
use Laravel\Ai\Attributes\Provider;
use Laravel\Ai\Contracts\Agent;
#[Provider('bedrock')]
class SummaryAgent implements Agent
{
public function prompt(): string
{
return 'Summarize the given text concisely.';
}
}use Laravel\Ai\Facades\Ai;
$response = Ai::prompt('Explain quantum computing.', provider: 'bedrock');$stream = Ai::stream('Write a short story.', provider: 'bedrock');
foreach ($stream as $event) {
echo $event->text;
}php artisan test --filter=BedrockMIT