Skip to content

Latest commit

 

History

History
111 lines (76 loc) · 4.43 KB

File metadata and controls

111 lines (76 loc) · 4.43 KB

AgentTasks

Overview

Available Operations

create

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.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.CreateAgentTaskResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        CreateAgentTaskResponse res = sdk.agentTasks().create()
                .call();

        if (res.agentTask().isPresent()) {
            System.out.println(res.agentTask().get());
        }
    }
}

Parameters

Parameter Type Required Description
request CreateAgentTaskRequestBody ✔️ The request object to use for the request.

Response

CreateAgentTaskResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 404, 422 application/json
models/errors/SDKError 4XX, 5XX */*

revoke

Revokes a pending agent task.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.RevokeAgentTaskResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        RevokeAgentTaskResponse res = sdk.agentTasks().revoke()
                .agentTaskId("<id>")
                .call();

        if (res.agentTask().isPresent()) {
            System.out.println(res.agentTask().get());
        }
    }
}

Parameters

Parameter Type Required Description
agentTaskId String ✔️ The ID of the agent task to be revoked.

Response

RevokeAgentTaskResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 404 application/json
models/errors/SDKError 4XX, 5XX */*