Skip to main content

Overview

Tasks are GitHub Actions-style workflows that define multi-step actions in Julep. Think of them as recipes that tell an agent exactly how to accomplish a goal. For example, a task might outline the steps to “Summarize a Research Paper” or “Debug a Code Issue”.
Here are some of the key features of tasks:
  • Connect multiple AI operations seamlessly
  • Make decisions based on intermediate results
  • Run operations in parallel for efficiency
  • Integrate with external tools and APIs
  • Maintain state throughout execution

Components

A task consists of several key components which can be broadly classified into:

Input Schema

YAML
⚠️ Workflow Input Size Warning: Avoid passing extremely large objects as input to your workflows, as this can cause execution failures. Large inputs (such as massive JSON objects, extensive arrays, or huge text files) may exceed memory limits or hit serialization constraints.What to do instead:
  • Break large data into smaller chunks and process them iteratively
  • Use file uploads and pass file references instead of raw content
  • Implement pagination for large datasets
Rule of thumb: If your input data is larger than a few megabytes, consider alternative approaches.

Tools

Tools are functions that can be used by an agent to perform tasks. Julep supports: Learn more about tools here.
YAML

Sub-Workflows

A task can be made up of multiple sub-workflows. These sub-workflows can be named and can be used to break down complex tasks into smaller, more manageable pieces.
YAML
You can learn more about sub-workflows here.

Steps

We use tasks and workflows interchangeably. They are the same except Julep’s branding reflects tasks.
Below is a table of all the steps that can be used in a task.
You can learn more about workflow steps as to how they work in the Workflow Steps section.

Context Variables

Tasks have access to three types of context:

Input Variables

Access input parameters:
YAML

Step Results

Use outputs from previous steps:
YAML
In any step, you can access the input and output of a step using the steps[index].output or steps[index].input variable. For example:
In Julep, the steps are indexed from 0. So the first step is steps[0] and the second step is steps[1] and so on. Furthermore the first step input is nothing but the task input and the last step output is nothing but the output of the task.
To learn more about how to use the $ variable and new syntax, please refer to the New Syntax section.

Environment Context

Access agent and session data:
YAML
Input schemas help catch errors early by validating all inputs before execution starts.
Here’s how these components work together:
YAML
Learn more about tools here.

Metadata

Metadata is a key-value pair that can be used to categorize and filter tasks.

How to Use Tasks ?

Creating a Task

Here’s a simple task that summarizes a document and checks if the summary is too long. We first define the task in a YAML file and then create it using the Julep SDK.
Check out the API reference here or SDK reference (Python here or JavaScript here for more details on different operations you can perform on tasks.

Executing a Task

Here’s how to execute a task:
Check out the API reference here or SDK reference (Python here or JavaScript here for more details on different operations you can perform on tasks.

Relationship to Other Concepts

This section will help you understand how tasks relate to other concepts in Julep.

Agents

Julep agents can power tasks by providing memory, context, or tools. Tasks are multi-step workflows designed for complex, automated execution. Whenever you create a task, you can associate it with an agent if you want to leverage that agent’s capabilities. Unlike sessions, tasks are not meant for real-time interaction; they run through a defined workflow to achieve a goal. For example:

Tools

Task can leverage tools to perform complex operations. There are 2 ways of defining tools for tasks:
  1. Associate a tool with an agent, and inherit it in the task definition by setting inherit_tools to true while creating the task. Example:
  1. Define a tool in the task definition. Example:
When you define a tool in the task definition, it is available to all steps in that task only. On the other hand, when you associate a tool with an agent, it is available to all the Tasks associated with that agent.

Best Practices

Keep Tasks Focused

  • 1. Purpose: Each task should have a single, clear purpose
  • 2. Subtasks: Break complex workflows into smaller subtasks

Handle Errors Gracefully

  • 1. Error Handling: Use try/catch blocks for error-prone operations
  • 2. Error Messages: Provide helpful error messages
  • 3. Fallback Options: Include fallback options where appropriate

Optimize Performance

  • 1. Parallel Execution: Use parallel execution when steps are independent
  • 2. Map-Reduce: Use map-reduce to run steps in parallel

Next Steps

  • Workflow Steps - Learn about all available step types
  • Tools - Learn about tools and how to use them in tasks
  • Sessions - Learn about sessions and how to use them in tasks

See Examples