Skip to content

Latest commit

 

History

History
100 lines (67 loc) · 4.49 KB

File metadata and controls

100 lines (67 loc) · 4.49 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

import clerk_backend_api
from clerk_backend_api import Clerk


with Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:

    res = clerk.agent_tasks.create(request={
        "on_behalf_of": {
            "user_id": "<id>",
            "identifier": "<value>",
        },
        "permissions": clerk_backend_api.CreateAgentTaskPermissions.WILDCARD_,
        "agent_name": "<value>",
        "task_description": "<value>",
        "redirect_url": "https://brilliant-typewriter.net",
    })

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
request models.CreateAgentTaskRequestBody ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.AgentTask

Errors

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

revoke

Revokes a pending agent task.

Example Usage

from clerk_backend_api import Clerk


with Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:

    res = clerk.agent_tasks.revoke(agent_task_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
agent_task_id str ✔️ The ID of the agent task to be revoked.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.AgentTask

Errors

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