Create and Execute a Julep Task

This guide will walk you through the process of creating a Julep task and executing it.

This guide is based on the Trip Planning task. For a detailed explanation of the task’s workflow, please check out the corresponding Trip Planning tutorial.

Step 1: Initialize the Julep Client

First, you need to initialize the Julep client with your API key.

Step 2: Create a Julep Agent

Create an agent to associate the task with. In Julep, tasks are scoped to agents, and agents take on the responsibility of executing tasks.

Step 3: Create a Julep Task

In this step, you will define the task that the Julep agent will execute. This involves specifying the task’s name, description, input schema, tools, and the main workflow. The task definition is written in YAML format and includes details about the integrations and the logic for processing the input data.

Step 4: Execute the Julep Task

Once the task is created, you can execute it by providing the necessary input that matches the task’s input schema. This step involves calling the execute method on the task, which will start the task execution process.

Step 5: Get the Task Execution Result

After executing the task, you can retrieve the results by checking the execution status and output. This step involves polling the execution status until it reaches a terminal state (succeeded, failed, or cancelled) and printing the current output. Alternatively, you can fetch the execution transitions for a more detailed view of the task’s progress, which is useful for debugging.

Fetching the Execution Status & Current Output

Fetching the Execution Transitions

Full Example

Conclusion

This guide provided a comprehensive overview of how to create and execute a Julep task. It covered the necessary steps, including initializing the Julep client, creating an agent, defining the task, executing it, and retrieving the results. By following these steps, you can effectively use Julep’s capabilities to automate complex workflows and achieve your goals.

Next Steps

  • Tasks - Learn about Julep tasks in more details and see other tasks steps.
  • Tutorials - Check out other tutorials to see more real-world examples of Julep in action.
  • Cookbooks - Easy to run Jupyter notebooks to execute Julep tasks.