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

# Get Task

> Learn how to use the Get Task utility to retrieve and work with task information

<div style={{ display: 'flex', justifyContent: 'center', margin: '2rem 0' }}>
  <div className="video-card">
    <video src="https://lindy-docs-content.nyc3.digitaloceanspaces.com/Human%20in%20Loop.mp4" width="600" autoPlay muted loop playsInline style={{ display: 'block', width: '100%', borderRadius: '16px' }} />
  </div>
</div>

# Get Task

The Get Task utility allows you to retrieve information about the current task or specific tasks in your Lindy workflow. This is useful for accessing task metadata, status, and related information.

## What is Get Task?

Get Task is a utility that provides access to task-related information within your Lindy workflows. It can retrieve details about the current task being executed or fetch information about other tasks in your system.

## Use Cases

* **Task Status Checking**: Verify the current status of a task
* **Metadata Access**: Retrieve task metadata like creation time, assignee, or custom fields
* **Task History**: Access information about previous task executions
* **Conditional Logic**: Use task information to make decisions in your workflow

## How to Use Get Task

### Basic Usage

```javascript theme={null}
// Get information about the current task
const currentTask = await getTask();

// Access task properties
console.log(currentTask.id);
console.log(currentTask.status);
console.log(currentTask.createdAt);
```

### Getting Specific Tasks

```javascript theme={null}
// Get a specific task by ID
const task = await getTask({
  taskId: "task_123456"
});

// Get tasks with filters
const tasks = await getTask({
  status: "completed",
  limit: 10
});
```

## Task Properties

When you retrieve a task, you'll have access to these properties:

* **id**: Unique identifier for the task
* **status**: Current status (pending, running, completed, failed)
* **createdAt**: Timestamp when the task was created
* **updatedAt**: Timestamp when the task was last updated
* **metadata**: Custom data associated with the task
* **result**: Output or result from task execution
* **error**: Error information if the task failed

## Integration Examples

### With Conditions

```javascript theme={null}
// Check if a task is completed before proceeding
const task = await getTask();
if (task.status === "completed") {
  // Proceed with next action
}
```

### With Memory

```javascript theme={null}
// Store task information in memory for later use
const task = await getTask();
await setVariable("lastTaskId", task.id);
await setVariable("lastTaskStatus", task.status);
```

## Best Practices

* **Error Handling**: Always check for errors when retrieving tasks
* **Caching**: Consider caching task information if you need it frequently
* **Permissions**: Ensure your agent has the necessary permissions to access task information
* **Performance**: Limit the number of task queries to avoid performance issues

## Related Utilities

* **Set Variable**: Store task information for later use
* **LLM Call**: Use task information in AI prompts
* **Memories**: Store task history for long-term reference

## Next Steps

<CardGroup cols={2}>
  <Card title="Set Variables" href="/skills/lindy-utilities/set-variables" icon="database">
    Store task information for later use
  </Card>

  <Card title="LLM Call" href="/skills/lindy-utilities/llm-call" icon="database">
    Use task information in AI prompts
  </Card>

  <Card title="Memories" href="/skills/lindy-utilities/memories" icon="database">
    Store task history for long-term reference
  </Card>

  <Card title="Observability" href="/skills/lindy-utilities/observability" icon="magnifying-glass">
    Advanced task monitoring and performance analysis
  </Card>
</CardGroup>
