Create an agent task on behalf of a user. The response contains a URL that, when visited, creates a session for the user. The agent_id is stable per agent_name within an instance. The task_id is unique per call.
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
$sdk = Backend\ClerkBackend::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->agentTasks->create(
request: $request
);
if ($response->agentTask !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\CreateAgentTaskRequestBody | ✔️ | The request object to use for the request. |
?Operations\CreateAgentTaskResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ClerkErrors | 400, 404, 422 | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Revokes a pending agent task.
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
$sdk = Backend\ClerkBackend::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->agentTasks->revoke(
agentTaskId: '<id>'
);
if ($response->agentTask !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
agentTaskId |
string | ✔️ | The ID of the agent task to be revoked. |
?Operations\RevokeAgentTaskResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ClerkErrors | 400, 404 | application/json |
| Errors\SDKException | 4XX, 5XX | */* |