PHP code example of cognesy / agent-ctrl

1. Go to this page and download the library: Download cognesy/agent-ctrl 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/ */

    

cognesy / agent-ctrl example snippets


use Cognesy\AgentCtrl\AgentCtrl;
use Cognesy\AgentCtrl\Config\AgentCtrlConfig;

$response = AgentCtrl::codex()
    ->withConfig(new AgentCtrlConfig(
        timeout: 300,
        workingDirectory: getcwd() ?: null,
    ))
    ->execute('Summarize this repository.');

echo $response->text();

$response = AgentCtrl::codex()->execute('Create a plan.');

echo (string) $response->executionId(); // one run
echo (string) ($response->sessionId() ?? ''); // provider session, if available