PHP code example of durable-workflow / ai

1. Go to this page and download the library: Download durable-workflow/ai 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/ */

    

durable-workflow / ai example snippets


use DurableWorkflow\AI\Workflows\SandboxAgentWorkflow;
use Workflow\V2\WorkflowStub;

$workflow = WorkflowStub::make(SandboxAgentWorkflow::class);

$workflow->start(
    toolCalls: [
        [
            'type' => 'write_file',
            'args' => [
                'path' => 'README.md',
                'contents' => "# Agent workspace\n",
            ],
        ],
        ['type' => 'shell', 'args' => ['command' => 'ls -la']],
    ],
    provider: 'e2b',
    snapshotEveryNCalls: 10,
);
bash
php artisan queue:work