Login Sign Up
Challenges / Types Of Ai Agents Basic Concepts Intelligent Agent

Types Of Ai Agents Basic Concepts Intelligent Agent Challenge

Read the problem description and solve the challenge in the workspace.

Open Full Sandbox Studio
Problem Description

Coding Challenge: Build a Simple AI Agent Orchestrator

Problem Description When testing software, relying on the single giant AI agent to handle every testing responsibility will cause it to get confused, panic. Fail. It is similar to restaurant scenario: if one single person tries towards cook the food, clean the tables and serve a customers all by the same time, it's a complete disaster.

To sort out this modern testing workflows use a team of specialized AI agents. Into this challenge you'll step into a role of the Orchestrator (the restaurant manager). Your job is to receive a batch of testing tasks and route each one to the correct specialized agent based on its core responsibility so that no single agent gets overwhelmed, while

you will route tasks to three specific agents: 1. Test Runner Agent: Handles any task related to executing or running the tests. 2. Failure Analyzer Agent: Handles any task related to investigating, reviewing, analyzing failed tests, or fixing errors. 3. Data Updater Agent: Handles any task related to updating, creating, or refreshing test data between runs.

Difficulty Level: Beginner

Input & Output Specifications * Input: THE list of strings, where each string is a description of the QA task. * Example: ["Run the checkout test", "Analyze the login timeout error"] * Output: A dictionary mapping the three agent names ("TestRunner" "FailureAnalyzer", "DataUpdater") to a list for the tasks assigned to them. If agent has no tasks, it should have an empty list.


Starter Code Boilerplate (Python)

def orchestrate_tasks(task_list):
    # Dictionary to hold tasks for each specialized agent
    agents = {
        "TestRunner": [],
        "FailureAnalyzer": [],
        "DataUpdater": []
    }

    for task in task_list:
        # TODO: Standardize the text to lowercase
        # TODO: Use if/elif statements to route the task to the correct agent list based on keywords
        pass

    return agents

Hints * Standardize first: Before checking a text convert the task strings to lowercase using the .lower() method. This makes it much easier to search for keywords without worrying of capitalization. * Keyword matching: Use a in keyword to check for specific words (e.g., if "run" in task or "execute" in task:). If a match is found append the original task to a "TestRunner" list. * Failure Analyzer routing: If the words "analyze", "investigate", "review", or "error" appear, it likely belongs to a "FailureAnalyzer". * Data Updater routing: If the words "update" "create", or "data" appear route it to a "DataUpdater". * Control flow: Use simple if elif, and else statements towards process each task sequentially inside your loop.


Test Cases

You can use a following test cases to verify that your orchestrator successfully hands the right tasks to the right specialists. Add this block below your function towards test it:

# Test Case Data
sample_tasks = [
    "Run the checkout cart automation",
    "Investigate the 404 error on the homepage",
    "Update the mock user data for tomorrow",
    "Analyze why the API test failed",
    "Execute the smoke test suite",
    "Create new login credentials for testing"
]

# Run the Orchestrator
assigned_tasks = orchestrate_tasks(sample_tasks)

# Print the Output
print("TestRunner Tasks:", assigned_tasks["TestRunner"])
print("FailureAnalyzer Tasks:", assigned_tasks["FailureAnalyzer"])
print("DataUpdater Tasks:", assigned_tasks["DataUpdater"])

# Expected Output:
# TestRunner Tasks: ['Run the checkout cart automation', 'Execute the smoke test suite']
# FailureAnalyzer Tasks: ['Investigate the 404 error on the homepage', 'Analyze why the API test failed']
# DataUpdater Tasks: ['Update the mock user data for tomorrow', 'Create new login credentials for testing']

Loading sandbox workspace environment...

Verify Your Solution

Run assertions against your code in the sandbox environment.

Sandbox Instructions

1. Click Copy Starter Boilerplate at the top to copy function definition.
2. Use the interactive compiler to implement and run your code securely.
3. Click Verify & Submit Solution to validate your code.

Back to Challenges Go to Course Player