function checkItemPresence(data, agent) {

    try {
        // Special handling for hells_kitchen tasks
        if (data.task_id && data.task_id.endsWith('hells_kitchen') && Array.isArray(data.target) && data.target.length === 2) {
            
            // Get agent ID and target for this agent
            const agentId = agent.count_id;
            
            if (agentId === 0 || agentId === 1) {
                // Use only the corresponding element from the target list
                const targetForThisAgent = data.target[agentId];
                const modifiedData = {
                    ...data,
                    target: targetForThisAgent
                };
                
                // Check if this agent has their required item
                const agentResult = checkItemForSingleAgent(modifiedData, agent);
                
                // Update the file-based progress tracker
                const progress = hellsKitchenProgressManager.updateAgentProgress(
                    data.task_id, 
                    agentId, 
                    agentResult.success
                );
                
                // // Log the current state
                // console.log(`Agent ${agentId} has item: ${agentResult.success}`);
                // console.log(`Task state: Agent0=${progress.agent0Complete}, Agent1=${progress.agent1Complete}`);
                
                // Return combined result - success only if both agents have their items
                return {
                    success: progress.agent0Complete && progress.agent1Complete,
                    missingItems: agentResult.missingItems,
                    agentComplete: agentResult.success  // Individual agent status for debugging
                };
            }
        }
        
        // Non-hells_kitchen tasks use the standard check
        return checkItemForSingleAgent(data, agent);
        
    } catch (error) {
        console.error('Error checking item presence:', error);
        return {
            success: false,
            missingItems: [],
            error: error.message
        };
    }
}
Validates the presence of required items in an agent's inventory
@param {Object} data - Task data containing target and quantity information
@param {Object} agent - Agent object with bot inventory
@returns {Object} Validation result with success status and missing items