> ## Documentation Index
> Fetch the complete documentation index at: https://docs.deepvista.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Automate Linear Tickets

> Learn how to use DeepVista Task Delegation to let a locally-connected CLI agent create Linear tickets headlessly, keeping credentials on your own machine.

## Overview

By the end, DeepVista will file Linear tickets automatically from a cloud-triggered prompt, while your Linear API token never leaves your own machine.

DeepVista provides a powerful **Task Delegation** feature. When a cloud agent encounters an operation that requires a local environment, a specific CLI, or particular credentials (such as an API key), it can package the work as a `task` card and dispatch it to a CLI agent connected on the user's local machine.

This tutorial demonstrates how to configure and use DeepVista Task Delegation to create Linear tickets headlessly and automatically.

## Prerequisites

<Note>
  Deep Workflows need a connected machine before you can run them. Complete these three setup steps first, in order:
</Note>

<CardGroup cols={2}>
  <Card title="Mac Setup" icon="terminal" href="/tutorials/mac-setup">
    Install the developer tools and Claude Code CLI this setup depends on.
  </Card>

  <Card title="Set Up Your Claude Code Connector" icon="link" href="/tutorials/server/claude-connector-delegation">
    Authenticate Claude Code with your Claude account.
  </Card>

  <Card title="Connect Your Own Machine" icon="server" href="/tutorials/server/local">
    Install the DeepVista CLI and connect your machine as a local runner.
  </Card>
</CardGroup>

With your machine connected and `deepvista tasks run` polling, configure Linear API credentials:

```bash theme={null}
export LINEAR_TOKEN="your_linear_api_token"
```

*Note: The agent retrieves this variable securely within your local environment and never uploads the credential in plaintext or leaks it to logs.*

## Step-by-step guide

<Steps>
  <Step title="Create a task-type context card">
    In DeepVista, a Task is essentially a Context Card with `type: "task"` and `status: "pending"`. Its `description` contains a YAML metadata prefix along with the specific prompt you want to execute.

    **Example card configuration:**

    * **Type**: `task`
    * **Status**: `pending`
    * **Title**: `Create a test Linear ticket`
    * **Description**:

    ```yaml theme={null}
    ---
    agent_id: "your-machine-id"  # Fill in the local Machine ID you connected
    agent_role: "engineering"
    ---
    Please create a test Linear ticket.

    To do this:
    1. Search the local machine (environment variables, config files, or helper tools) for any Linear API credentials (such as LINEAR_API_KEY, LINEAR_TOKEN, etc.).
    2. If credentials are found, use the Linear GraphQL API (via curl or python) to create a new ticket in an active workspace.
       - Title: "DeepVista Test Ticket"
       - Description: "This is a test ticket filed automatically by DeepVista agent task delegation."
    3. Report the status of the ticket, the ticket key/ID, or a URL to the ticket if successfully created.
    ```
  </Step>

  <Step title="Cloud dispatch and local claim">
    1. The cloud agent stores this task card in the database.
    2. The local CLI agent (polling via `deepvista tasks run`) retrieves the pending task and invokes Claude locally to execute the prompt:
       * Claude checks the local environment variable `LINEAR_TOKEN`.
       * It sends an `issueCreate` request to Linear via the GraphQL API.
  </Step>

  <Step title="Capture the results">
    Once execution completes, the local agent writes the run log (`## Run`) and the final result card (`type: "note"`) back to DeepVista, and automatically updates the Task's `status` to `completed`.

    **Example final result**:

    * **Key**: `DV-1373`
    * **Title**: DeepVista Test Ticket
    * **URL**: `https://linear.app/deepvista/issue/DV-1373/deepvista-test-ticket`
  </Step>
</Steps>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.