Usage

Here’s how to use this task with the Julep SDK:

from julep import Client
import time
import yaml

# Initialize the client
client = Client(api_key=JULEP_API_KEY)

# Create the agent
agent = client.agents.create(
  name="Julep Trip Planning Agent",
  about="A Julep agent that can generate a detailed itinerary for visiting tourist attractions in some locations, considering the current weather conditions.",
)

# Load the task definition
with open('trip_planning_task.yaml', 'r') as file:
  task_definition = yaml.safe_load(file)

# Create the task
task = client.tasks.create(
  agent_id=AGENT_ID,
  **task_definition
)

# Create the execution
execution = client.executions.create(
    task_id=task.id,
    input={
        "locations": ["New York", "London", "Paris", "Tokyo", "Sydney"]
    }
)

# Wait for the execution to complete
while (result := client.executions.get(execution.id)).status not in ['succeeded', 'failed']:
    print(result.status)
    time.sleep(1)

# Print the result
if result.status == "succeeded":
    print(result.output)
else:
    print(f"Error: {result.error}")

Example Output

An example output when running this task with an input of ["New York", "London", "Paris", "Tokyo", "Sydney"]:

Next Steps

  • Try this task yourself, check out the full example, see the trip-planning cookbook.
  • To learn more about the integrations used in this task, check out the integrations page.