PHP code example of promptphp / intercept-tool-approval-guard

1. Go to this page and download the library: Download promptphp/intercept-tool-approval-guard library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

promptphp / intercept-tool-approval-guard example snippets


use Laravel\Ai\Contracts\HasMiddleware;
use PromptPHP\Intercept\ToolApprovalGuard\ToolApprovalGuard;

class SupportAgent implements Agent, HasMiddleware
{
    public function middleware(): array
    {
        return [
            new ToolApprovalGuard,
        ];
    }
}

new ToolApprovalGuard(
    deniedTools: ['delete_record'],
)

new ToolApprovalGuard(
    allowedTools: ['search_docs', 'read_ticket'],
)

new ToolApprovalGuard(
    action: 'log',
)
sh
php artisan vendor:publish --tag=intercept-config